ramosj
August 15, 2016, 11:23pm
1
I use this plugin in Angular to Filters: https://github.com/a8m/angular-filter And that perfect to it.
Well, I have to create many filters. I intent create a View with checkboxes, like:
`
<form class="list" ng-submit="">
<ion-list>
<ion-radio ng-model="sortby" ng-value="'n'" >Nome</ion-radio>
<ion-radio ng-model="sortby" ng-value="'plh'" >Preço (Menor-Maior)</ion-radio>
<ion-radio ng-model="sortby" ng-value="'phl'" >Preço (Maior-Menor)</ion-radio>
</ion-list>
<div class="list box">
<button class="button button-block button-calm" type="submit">Aplicar</button>
</div>
</form>
</ion-content>
`
And conform the option selected, change the filter in the original View. But, How I can do it?
JC_cap
August 16, 2016, 7:29am
2
If you put your filter in a different view than the one i which you atually want your data to be filtered, you have to pass your filter value from one view to the other, with parameters for exemple.
If you wonder how to get your filter to work, just use
<li ng-repeat="item in itemsFromYourList | filter:{item.value:sortby}">
Tell me if this answers in any way to your problem.
ramosj
August 16, 2016, 2:13pm
3
Yes, but the item.value have to be dinamic.
My ng-repeat=“item in ofertass | filter:q as results” I want change the filter according user selected in another view or modal…
JC_cap
August 16, 2016, 2:48pm
4
you can do it like this, to filter different fields with different input for instance :
ng-repeat="item in itemsList | filter:{item.name:myNameFilter, item.description:myDescriptionFilter, ...}"