html – ng-switch-when-separator不在angularJS中工作

html – ng-switch-when-separator不在angularJS中工作,第1张

概述当我使用ng-switch-when-separator时,ng-switch不工作. 当我选择设置时,开关指向默认div angular.module("myModule", []) .controller("myController", function ($scope) { $scope.items = ['settings', 'home', 'options', 'other' 当我使用ng-switch-when-separator时,ng-switch不工作.
当我选择设置时,开关指向默认div

angular.module("myModule",[]) .controller("myController",function ($scope) {    $scope.items = ['settings','home','options','other'];    $scope.opt = $scope.items[0];  });
<script src="https://AJAX.GoogleAPIs.com/AJAX/libs/angularJs/1.2.23/angular.min.Js"></script><body ng-app="myModule">    <div ng-controller="myController">        <select ng-model="opt" ng-options="item for item in items">        </select>        <code>selection={{opt}}</code>        <hr />        <div             ng-switch on="opt">            <div  ng-switch-when="settings|options" ng-switch-when-separator="|">Settings div</div>            <div  ng-switch-when="home">Home Span</div>            <div  ng-switch-default>default</div>        </div>    </div></body>
解决方法 这是文档页面的问题,但不是Angular本身的错误.
怎么了:

>默认情况下,文档显示当前主分支的API(也称为快照)
>嵌入式plnkrs还使用主分支中构建的角度文件
>自动创建的plnkrs回退到最新的稳定版本(在这种情况下为1.5.8),它还不支持分隔符.

所以你必须等待1.5.10才能使用该功能.

总结

以上是内存溢出为你收集整理的html – ng-switch-when-separator不在angularJS中工作全部内容,希望文章能够帮你解决html – ng-switch-when-separator不在angularJS中工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1088060.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存