将输入ng模型搜索添加到组过滤

时间:2016-01-07 13:31:56

标签: angularjs angularjs-filter angularjs-ng-model

我想将输入ng-model搜索添加到我的角度应用程序

<div ng-app="app" ng-controller="Main">
<input ng-model="dddd"><br>
<div ng-repeat="playerPerTeam in playersToFilter() | filter:filterTeams">
<b>{{playerPerTeam.team}}</b>
  <li ng-repeat="player in players | filter:{team: playerPerTeam.team}">{{player.name}}</li> 
  </div>
</div>

整个代码在这里: https://jsfiddle.net/lukasz9999/070ebre7/2/

输入ng-model应该过滤player.name

感谢您的任何提示!

1 个答案:

答案 0 :(得分:2)

以下是一个例子:

https://jsfiddle.net/rokoala/143ea6xL/

searchFilter作为ng-model输入和过滤ng-repeat。

<input ng-model="searchFilter"><br>

<li ng-repeat="player in players | filter:{team: playerPerTeam.team} | filter:searchFilter">{{player.name}}</li>