Reputation: 1402
I want to display all data (contacts) that have bookmarked value set to 1
To do that I used this peace of code:
<ul class="span5">
<li class="nav-pills nav-stacked contact-row" data-ng-repeat="contact in contacts | orderBy:'firstName'" ng-show="contact.bookmarked('0')">
<span id=" ct-details-{{contact.id}}" data-ng-click="displayContact(contact.id)" style="cursor:pointer;" class="contact-data details-hidden" href="">
<span class="span3 contact-name">
{{contact.firstname + ' ' + contact.lastname}}
</span>
</span>
<button class="btn editContact" id="deleteContact-{{contact.id}}" data-ng-click="deleteContact(contact.id)">Delete</button>
<button class="btn editContact" id="editContact-{{contact.id}}" data-ng-click="editContact(contact.id)">Edit</button>
</li>
</ul>
When I use this code, contacts are not displayed (ones with value 1 and ones with value 0 are not displayed). Does someone knows where's the problem and how to fix it?
Upvotes: 1
Views: 354
Reputation: 17794
You should create a filter on your ngRepeat
query.
data-ng-repeat="contact in contacts | filter:{bookmarked:'0'} | orderBy:'firstName'"
Read more about here: https://docs.angularjs.org/api/ng/filter/filter
Upvotes: 2