AngularJs ng - if a function call from the same controller does not work
<div ng-repeat=" x in z"> <div ng-if="function(x).y" > display this </div> </div> In the above code, the ng-if (x) function does not receive the call without updating.
Please check and suggest if I am missing any thing?
+7
akmsharma
source share1 answer
Here is a 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 .
+12
Andrew Shustariov
source share