我刚刚开始使用角度,我需要根据从下拉列表中选择的项目过滤我显示的内容。
<div title="{{agreement.number}} - {{agreement.provider}}" ng-show="agreement.provider.toLowerCase().indexOf(searchParam.toLowerCase()) != -1 || agreement.sa_id.toLowerCase().indexOf(searchParam.toLowerCase()) != -1" ng-repeat="agreement in tableList | orderBy : 'number' track by $index | filter: provider:selectedProduct ">
<a href="#" style="display:block;">
<div class="itemContainerList" ng-class="{'gridview': !ListView , 'listViewAnimate': ListView}">
<div>
<div class="alignItemContainerList">
<div>
<img class="list_normal" src="img_list_logo_blank_hsbcSA.svg" />
<img class="list_hover" src="img_list_logo_geralSA.svg" />
</div>
<div class="alignItemContainerText">
{{agreement.number}} - {{agreement.provider}}
</div>
</div>
</div>
</div>
</a>
</div>
我的javascript代码如下:
<!-- language: javascript -->
$scope.selectItem = function(car) {
$scope.selectedBusiness = car;
$scope.showList = false;
$scope.overlay = false;
};
答案 0 :(得分:1)
如果您有一个试图用作过滤器的元素,那么它应该如下所示,
<input type="text" ng-model="search.fullname"/>
然后你必须在下面添加一个过滤器,如下所示
<div ng-repeat="agreement in tableList | orderBy : 'number' track by $index | filter: search">
请参阅此链接以获取更多信息https://docs.angularjs.org/api/ng/filter/filter