View:
<html ng-app="myApp">
....
<body>
<div ng-controller="myCtrl">
<p>Current user {{loggedOnUser}}</p>
<div ng-if="user.name == {{loggedOnUser}}" ng-repeat="user in users">
<p>Should display</p>
</div>
</div>
</body>
</html>
Controller:
angular.module("myApp", [])
.controller("myCtrl", function($scope){
$scope.loggedOnUser = "xxx"; // for testing purpose
$scope.users = [
{
name : "xxx",
age: "25"
},
{
name : "yyy",
age: "26"
}
];
});
How to use ng-if with angularJS expression or is there any other way to achieve this?? I want to show that div if my loggedOnUser is equal to user.name
Thanks in advance
loggedInUser.$compiledoes that for theng-ifdirective