【发布时间】:2015-07-14 05:42:21
【问题描述】:
我正在前端使用 AngularJS 编写应用程序。我想按任何单词/字段搜索表格;一个搜索框搜索所有内容。根据这里的这篇文章:http://hello-angularjs.appspot.com/searchtable 我可以使用 filter: searchKeyword 来做到这一点。
这是我的代码,它没有按预期工作。
<label>Search: <input ng-model="searchKeyword"></label>
<table ng-repeat="post in posts | orderBy: sort | filter: searchKeyword">
<tr>
<td> {{index(post)}} </td>
<td> {{post.title}} </td>
<td> {{post.author}} </td>
<td> {{post.content}} </td>
<td> {{post.date | date: "d/M/yyyy"}} </td>
</tr>
</table>
我该怎么办?谢谢
【问题讨论】:
-
请向我们展示您的控制器。
-
请参考这篇新文章并进行一些修改。我的控制器代码在那里@isherwood 谢谢! stackoverflow.com/questions/31394920/…
标签: angularjs filter angularjs-ng-repeat angular-ngmodel angular-filters