I want to display all data (contacts) that have bookmarked value set to 1
我想显示已将书签值设置为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?
当我使用此代码时,不显示联系人(值1的值和值0的值不显示)。有谁知道问题出在哪里以及如何解决?
1 个解决方案
#1
2
You should create a filter on your ngRepeat
query.
您应该在ngRepeat查询上创建一个过滤器。
data-ng-repeat="contact in contacts | filter:{bookmarked:'0'} | orderBy:'firstName'"
Read more about here: https://docs.angularjs.org/api/ng/filter/filter
在这里阅读更多信息:https://docs.angularjs.org/api/ng/filter/filter
#1
2
You should create a filter on your ngRepeat
query.
您应该在ngRepeat查询上创建一个过滤器。
data-ng-repeat="contact in contacts | filter:{bookmarked:'0'} | orderBy:'firstName'"
Read more about here: https://docs.angularjs.org/api/ng/filter/filter
在这里阅读更多信息:https://docs.angularjs.org/api/ng/filter/filter