I'm trying to use ng-if in angular.js. I have a json file:
"data":[{
"status":"true",
"name":"blabla",
"group":true,
"group_id":"123gr",
"id":"xx1"
},{
"status":"true",
"name":"blabla2",
"group":false,
"id":"123gr",
"group_id":"null"
}]
And from this JSON I try to get a list of all groups (group in JSON must set be true) and then list group's elements. So I want to have a list that looks:
I tried to list just a group name.. in this way:
<ul>
<div ng-repeat="resp in response.data">
<li ng-if="{{resp.group}} === 'false'">
Group: {{resp.name}}
</li>
</div>
</ul>
Unfortunately it does not work. Do you have any idea what I did wrong?
Thank you for your help,
Luke
Or you could remove those altogether if you don't need them by filtering them out of ng-repeat
<ul>
<li ng-repeat="resp in response.data | filter: {group: true}">
Group: {{resp.name}}
</li>
</ul>