这是我的控制器:
varDemoApp.controller('SimpleController',function($scope){
$scope.customers = [{name:'Ahsan',city:'Khulna'},
{name:'Rokib',city:'Bogra'},
{name:'Asad',city:'Satkhira'}];
});
我的HTML代码是:
<div data-ng-controller="SimpleController">
Name:
<br/>
<input type="text" data-ng-model="name"/>
<ul>
<li data-ng-repeat="cust in customers|filter:name|orderBy:'name'">
{{cust.city}}-{{cust.name}}
</li>
</ul>
</div>
我想仅通过&#39; customers.name&#39;过滤但现在它按整体客户数组过滤。
答案 0 :(得分:1)
是的,您可以将对象传递给过滤器表达式:
filter:{name:name}