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

RJV*_*RJV 5 html angularjs angularjs-directive angularjs-ng-switch

ng-switch我使用时无法正常工作ng-switch-when-separator.当我选择设置时,开关指向默认div

angular.module("myModule", [])
 .controller("myController", function ($scope) {
    $scope.items = ['settings', 'home', 'options', 'other'];
    $scope.opt = $scope.items[0];
  });
Run Code Online (Sandbox Code Playgroud)
<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 class="animate-switch-container"
            ng-switch on="opt">
            <div class="animate-switch" ng-switch-when="settings|options" ng-switch-when-separator="|">Settings Div</div>
            <div class="animate-switch" ng-switch-when="home">Home Span</div>
            <div class="animate-switch" ng-switch-default>default</div>
        </div>
    </div>
</body>
Run Code Online (Sandbox Code Playgroud)

Nar*_*etz 7

这是文档页面的问题,但不是 Angular本身的错误.怎么了:

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

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