ng-show and ng-hide not binding to given variable in angularjs -
i using ng-show , ng-hide show banner page. when logged in wanna show different banner logged out. have 2 div ng-show , ng-hide value changing in controller true , false.
html code:
first banner:
<div id="firstpageheader" class="navbar navbar-inverse" role="navigation" ng-show={{display}}>
second banner:
<div id="restpageheader" class="navbar-header" ng-hide={{display}}>
controller:
var logincontroller = function($scope){
$scope.display = true; $scope.loginuser = function(credentials){ console.log(credentials.username); $scope.display = false; } $scope.logout = function(){ console.log('logout'); $scope.display = true; }
so here according login , logout display value change true , false not happening value remains true. want know why value not getting changed used $scope.$apply()
ngshow
, nghide
directives expect expressions. should without curly braces {{
(which used expression interpolation):
ng-show="display"
Comments
Post a Comment