Reputation: 125
i just started working with angular and i need to filter what i show based on a item selected from a dropdown list.
<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>
My javascript code is the following:
<!-- language: javascript -->
$scope.selectItem = function(car) {
$scope.selectedBusiness = car;
$scope.showList = false;
$scope.overlay = false;
};
Upvotes: 0
Views: 52
Reputation: 462
If you have an element which you are trying to use as a filter, then it should be as below,
<input type="text" ng-model="search.fullname"/>
And then you will have to add a filter at the end as specified below
<div ng-repeat="agreement in tableList | orderBy : 'number' track by $index | filter: search">
Refer this link for more info https://docs.angularjs.org/api/ng/filter/filter
Upvotes: 1