I have created one Nav Controller in Angular JS as mentioned below.
weatherApp.controller('navCtrl', ["$scope", "$localStorage", function($scope, $localStorage){
if($localStorage.user_email){
var navItems = new Array();
navItems["/"] = 'Home';
navItems["/logout"] = 'Logout';
$scope.navItems = navItems;
}
else{
var navItems = new Array();
navItems["/"] = 'Home';
navItems["/login"] = 'Login';
$scope.navItems = navItems;
}
$scope.test = "test";
}]);
I am calling this controller in index.html as shown below.
<ul class="nav navbar-nav" ng-controller="navCtrl">
<li ng-repeat="(url, navItem) in navItems">
<a href="#{{ url }}">{{ navItem }}</a>
</li>
</ul>
if I keep navItems indexes alphanumeric then it does not load values but if I keep its indexes numeric, it show menu items.
Is there any way by which I can use alphanumeric indexes in ng-repeat?