我有一个数组,我根据选择的类别打印出它的元素
<li class="thumbnail" ng-repeat="temp in templates| filter:{temp.category_id : selectedCategoryId }:true">
模板看起来像这样:
[{"id":"1","account_id":null,"category_id":"1","name":"Blue","thumbnail":"placehold.it/210x300","category_name":"test"},{"id":"2","account_id":null,"category_id":"1","name":"Red","thumbnail":"placehold.it/210x300","category_name":"test"},{"id":"3","account_id":null,"category_id":"2","name":"Green","thumbnail":"placehold.it/210x300","category_name":"test again"}]
谢谢您的帮助 !
编辑:我还想添加一个额外的条件,即 temp.category_id == null ,全部显示。