I have an input which uses ng-value with a filter to display a number.
<input ng-value="myDataCollection | customFilter">
I want to also apply ng-class to change the text colour to red if negative.
<input ng-value="myDataCollection | customFilter" ng-class="{'negative-input': (myDataCollection | customFilter) < 0}">
This works, but in my use case the filter has a lot of work to do to calculate the resulting value. The input is also withing a large nested ng-repeat so performance is a concern.
Is it possible to use ng-class based on the resulting value of the input as set by ng-value without having to run through the filter twice?
This is what I would suggest. You can directly filter the values and save it in some model variable. so it's like you will run you filter on you data collection once and then use it anywhere you want.