【发布时间】:2016-05-31 04:35:34
【问题描述】:
我想为选定的对象字段应用角度过滤器。我有状态列表 ["waiting"、"conform"、"rac"],当我选择一个状态时,它应该提供表中具有该状态的人员的信息。
例如,如果某人的票符合,那么当我们选择status = conform 时,只有显示的人应该有符合票。等待和 rac 也是如此
请查看演示和代码。它不工作。请帮忙.. Please see the demo
HTML
<div class="col-md-12">
<table>
<thead>
<tr>Name</tr>
<tr>Status</tr>
</thead>
<tbody >
<tr ng-repeat="person in list| filter: status">
<td>{{person.name}}</td>
<td>{{person.status}}</td>
</tr>
</tbody>
</table>
</div>
控制器:
$scope.status_list=["waiting", "conform", "rac"];
$scope.list = [
{ 'name': 'A',
'status':'waiting'
},
{ 'name': 'B',
'status':'conform'
},
{ 'name': 'C',
'status':'rac'
}
]
【问题讨论】:
-
也发布您的过滤器代码以及为什么您不在表达式中使用过滤器
{{ person.name | status}} -
您希望对状态字段做什么?在该字段上按字母顺序排序?
-
命令是
ng-repeat而不是ng-repead -
@PankajParkar,如果您正在班加罗尔寻找机会,您好 Pankaj。我可以在我公司推荐你。我的公司名称是 Black-Buck Logistic。您可以从 1.timesofindia.indiatimes.com/tech/tech-news/… 获取有关该公司的更多信息
标签: javascript angularjs angularjs-ng-repeat angularjs-filter