【发布时间】:2015-08-05 07:59:46
【问题描述】:
我是 AngularJS 的新手。我有 3 个输入字段可以为单个帖子输入最多 3 个关键字:
<input type="text" ng-model="Keyword1"></input>
<input type="text" ng-model="Keyword2"></input>
<input type="text" ng-model="Keyword3"></input>
我正在使用 ng-repeat 显示帖子:
ng-repeat="post in posts | filter: searchKeyword"
...
并通过以下方式搜索:
Search Keyword: <input ng-model="searchKeyword.Keyword1">
如您所见,目前仅搜索每个帖子的第一个关键字。我怎样才能只有一个搜索字段来搜索帖子的所有三个关键字?我知道我不能只是这样做
<input ng-model="searchKeyword.Keyword1.Keyword2.Keyword3">
谢谢!
【问题讨论】:
标签: angularjs search angularjs-ng-repeat angular-ngmodel angular-filters