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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -