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?
ng-show
accepts expression.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
Post a Comment