I'm using angular to build a small web application. I'm trying to set up role based navigation. It seems as if the isAdmin function is not getting called on page load, as I can just see the foo anchor tag.
HTML
<body ng-controller='AccountController'>
<nav class="navbar navbar-default">
<ul>
<li><a href='google.com'>foo</a></li>
<li ng-if="isAdmin()"><a href='google.com'>bar</a></li>
</ul>
</nav>
</body>
AccountController
var app = angular.module('appControllers', []);
app.controller = angular.controller('AccountController', ['$scope',
function($scope, $http) {
$scope.isAdmin = function() {
return true; //Just as a test to make sure it works
}
}]);
Ideally this will hit a web service that will return the administrator status, but for now I'd like to get this to work.
Thanks for all the help in advance,
Andres