angularjs - ng-show directive not working properly -


i using ng-show directive show/hide alert box in ui:

<alert ng-show="{{showalert()}}">{{showalert()}}</alert>

my controller code is:

$scope.showalert = function () { return userform.$invalid || false; };

though getting correct value content of alert , able see booelan values in ui alert still keeps on showing.

any idea?

  1. ng-show accepts expression.
  2. userform lives in $scope.

template:

<span ng-show="showalert()">form invalid!!</span> 

controller:

$scope.showalert = function() {   return $scope.userform.$invalid || false; }; 

or, simply:

<span ng-show="userform.$invalid">form invalid!!!</span> 

and link working example: http://plnkr.co/edit/nlc1dbtk8vazbbgjnlb0


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -