Chicks Patel Chicks Patel - 1 month ago 6
AngularJS Question

How to apply filter inside curly brackets in angularjs?

How to write any filter inside {{}} curly brackets.

<span>{{viewController.viewModel.name == '' ? 'abcd' | upper : viewController.viewModel.name}}</span>


At here upper is filter and anykind of custom filter. I don't want to use ng-if twice for this only. This one is not working. It's gives error of filter

please suggest me good solution

Answer

I haven't tried this, but I think the filter needs to come after the expression, eg

<span>{{viewController.viewModel.name == '' ? 'abcd' : viewController.viewModel.name | upper}}</span>