我正在使用ng-repeat构建一个网格,如下所示:
[解决] : http://plnkr.co/edit/xOTOsv
<input type="text" placeholder="Buscar jogo" ng-model="gameCollection.name">
<div class="row" ng-repeat="game in colecao | filter:gameCollection" ng-if="$index%3==0">
<div class="col">
<img src="{{colecao[($index)].image}}" style="width:100%;" />
<p>{{colecao[($index)].name}}</p>
</div>
<div class="col">
<img src="{{colecao[($index+1)].image}}" style="width:100%;" />
<p>{{colecao[($index+1)].name}}</p>
</div>
<div class="col">
<img src="{{colecao[($index+2)].image}}" style="width:100%;" />
<p>{{colecao[($index+2)].name}}</p>
</div>
</div>
当我在输入中输入一个值时,Angular会过滤整行,而不仅仅是列。
任何人都知道如何过滤/删除与该词匹配的列?
答案 0 :(得分:0)
尝试此操作仅当输入的字符串位于&#34; name&#34;柱
<div class="row" ng-repeat="game in colecao | filter:gameCollection " ng-if="$index%3==0">
.
.
.
.
.
</div>