javascript - ng-show not working on returned function value? -
the logic simple. show link when there @ least 1 checkbox checked. within calculate checkbox function.
js
$scope.calculatechecked = function() { var count = 0; angular.foreach($scope.data, function(value) { if(value.checked) count++; }); if(count !=0){ return count; }else{ return "null"; } };
html
<a ng-show="{calculatechecked()}!='null'" ng-click="getlinks()"><p ng-show="loader==false" class="newtopic">open {{calculatechecked()}} topic</p></a>
i expect work ng-show="{calculatechecked()}!='null'"
but doesn't
remove braces in ng-show
<a ng-show="calculatechecked() != 'null'" ng-click="getlinks()"><p ng-show="loader==false" class="newtopic">open {{calculatechecked()}} topic</p></a>
Comments
Post a Comment