Ng-switch-when-separator does not work in angularJS

ng-switch does not work when I use ng-switch-when-separator . when i select the settings , the switch points to the default 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 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> 
+5
source share
1 answer

This is a problem with the documentation page, but not a bug in Angular. What's happening:

  • The default documents show the API for the current main branch (also called snapshot)
  • inline plnkrs also use Angular inline files from the main branch
  • automatically created plnkrs revert to the latest stable version (in this case 1.5.8), which does not yet support the delimiter.

So you have to wait 1.5.10 to use this function.

+6
source

Source: https://habr.com/ru/post/1258209/


All Articles