PictureFilter Angular的过滤器无法正常工作,如图所示,对于搜索'shi',它也可以找到abc-sea,nnnn-road行......
我试过这个:
<div flex="30">
<label>Search: <input ng-model="searchText"></label>
<table class="table table-hover" id="shipmentTable">
<thead>
<tr>
<th>
<a href="#" ng-click="sortType = 'name'; sortReverse = !sortReverse">
shipment name
<i ng-show="sortType == 'name' && !sortReverse"
class="fa fa-angle-up"></i>
<i ng-show="sortType == 'name' && sortReverse"
class="fa fa-angle-down"></i>
</a>
</th>
<th>
<a href="#" ng-click="sortType = 'transportMode'; sortReverse = !sortReverse">
transport mode
<i ng-show="sortType == 'transportMode' && !sortReverse"
class="fa fa-angle-up"></i>
<i ng-show="sortType == 'transportMode' && sortReverse"
class="fa fa-angle-down"></i>
</a>
</th>
</tr>
</thead>
<tbody class="member">
<tr ng-class='{selected: $index==selectedRow}'
ng-click="selectRow($index);getSelected(shipment);"
ng-repeat="shipment in shipments | orderBy:sortType:sortReverse | filter:searchText">
<td>{{shipment.name}}</td>
<td>{{shipment.transportMode}}</td>
</tr>
</tbody>
</table>
但它的工作不正确......可能会出现什么问题?
答案 0 :(得分:0)
目前,您通过对象shipment
过滤搜索包含,因此当前过滤器过滤器在其中的某个位置具有shi
。对property
,
{name: searchText}
应用过滤器
ng-repeat="shipment in shipments | orderBy:sortType:sortReverse | filter:{name:searchText}"