Reputation: 7758
I have this object
people = [{name: "John", registered: true },{name: "Micky", registered: false },{name: "Carol", registered: true }]
and I have this angular HTML:
<ul>
<li ng-repeat="person in people">
{{person.name}}
<div class="already-registered-icon"> </div>
</li>
</ul>
My question is - how do I make a condition to display the registered icon only when the user is already registered?
I would think of something like this (but I don't know how it can be written):
{{if person.registered}}
<div class="already-registered-icon"> </div>
{{end}}
Upvotes: 0
Views: 464
Reputation: 7758
It was the ng-show
attribute I was missing
<ul>
<li ng-repeat="person in people">
{{person.name}}
<div ng-show="person.registered" class="already-registered-icon"> </div>
</li>
</ul>
Upvotes: 0
Reputation: 54649
Just use ngShow:
<div ng-show="person.registered" class="already-registered-icon"> </div>
demo: http://jsbin.com/usodaw/1/
Upvotes: 2