我必须使用我想要使用相同指令过滤的数据分隔列表:
.directive('myFilter', function ($filter) {
return {
restrict: 'E',
templateUrl: 'my-dialog.html',
link: function ($scope) {
$scope.lov_state = [
{'lookupCode': 'AL', 'description': 'Alabama'},
{'lookupCode': 'FL', 'description': 'Florida'},
{'lookupCode': 'CA', 'description': 'California'},
{'lookupCode': 'DE', 'description': 'Delaware'}
];
}
};
});
页面如下所示:
<my-filter></my-filter>
<ul>
<li ng-repeat="item in data | filter:address.state">
{{item.name}}
</li>
</ul>
<my-filter></my-filter>
<ul>
<li ng-repeat="item in data2 | filter:address.state">
{{item.name}}
</li>
</ul>
</div>
目前,过滤器同时适用于ul?我需要更新什么以确保过滤器可以独立地运行两个列表?