How can I use AngularJS filter in ngClass?
In your case, you should use class
instead of ng-class
because you render the class name directly on the html without evaluation.
<div ng-controller="MyCtrl"> <i class="{{phone.trueVal | checkmark }}">{{phone.trueVal | checkmark}}</i> <i class="{{phone.falseVal | checkmark }}">{{phone.falseVal | checkmark}}</i></div>
This worked for me. Just stared with AngularJS so I'm not sure if the functionality was added as part of an update since this question is a couple years old.
ng-class="{ 'has-error': (login.form | validField:'username') }"
After adding the parentheses, it worked.