AngularJS passes custom filter result to another custom filter

I created two custom filters and tried to use them both in ng-repeat.

How can I pass the result of the first filter as input for the second filter?

I tried like (alias) in ng-repeat but it doesn't work,

<input type="text" ng-model = "ageLimit" />
<input type="text" ng-model = "lastSeen" />
<div ng-repeat = "member in lists | ageFilter:ageLimit:lists as results | LastSeenFilter:lastSeen:results">

      

Error message

Error: [ngRepeat: badident] alias' results | LastSeenFilter: lastSeen: results' not valid --- there must be a valid JS identifier that is not a reserved name. http://errors.angularjs.org/1.3.0/ngRepeat/badident?p0=results%20%7C%20LastSeenFilter%3AselectLastSeen%3Aresults

+3


source to share


2 answers


the problem is how . since I have the same problem, I looked inside ngRepeadDirective and found out that the regex there that breaks the expression doesn't support filters after the alias, as can be seen here .



+1


source


You can link filters in Angular. The output of the first filter will act as the input to the second, etc.



0


source







All Articles