AngularJs ng-if function call from same controller not working
42,813
Here is working example
angular.module('app', [])
.controller('ctrl', function($scope) {
$scope.z = [1,2,3];
$scope.display = function(x) {
return x === 2
};
});
<div ng-app="app" ng-controller='ctrl'>
<div ng-repeat=" x in z">
<div ng-if="display(x)" >
display this
</div>
</div>
</div>
And fiddle.
Author by
akmsharma
Updated on July 09, 2022Comments
-
akmsharma almost 2 years
<div ng-repeat=" x in z"> <div ng-if="function(x).y" > display this </div> </div>
In the above code, ng-if function(x) is not getting called without refresh.
Please check and suggest if I am missing any thing ?