I have created a scope like this
var myApp = angular.module("myApp", []);
myApp.controller("MyController", function MyController($scope){
$scope.sample = [
{'NUMBER' : '1'},{'NUMBER' : '2'},{'NUMBER' : '3'},{'NUMBER' : '4'}
]
});
I have tried like this.In this I need to retrieve the value which is return form the switch case and to display it in a particular field.
<div ng-repeat = "grp_val in sample">
<div ng-switch-on="{{grp_val.NUMBER}}">
<div ng-switch-when="1" ng-init="value='ONE'"></div>
<div ng-switch-when="2" ng-init="value='TWO'"></div>
<div ng-switch-when="3" ng-init="value='THREE'"></div>
<div ng-switch-when="4" ng-init="value='FOUR'"></div>
</div>
<label>{{VALUE}}</label>
</div>
But its not working.Kindly give some solution.
ng-initis designed for, it also won't work, for a variety of reasons; some examples of those reasons: your variable is a different case, your variable is a primitive instead of an object, your variable is in a different scope. Rethink your strategy here, this isn't the right way to use angular at all.