2

I have a ngModel data.type which is bound and I want to apply a filter actionType to it first and then add a prefix and then finally pass it to localize filter.

Something like:

<h3 data-ng-bind="'prefix.' + {{ data.type | actionType}} | localize "></h3>

So for e.g. if actionType filter returned my-action-type then I want to pass prefix.my-action-type to localize filter.

Is there anyway to do this?

Thanks

Satyam Koyani
  • 4,236
  • 2
  • 22
  • 48
RandomQuestion
  • 6,778
  • 17
  • 61
  • 97

1 Answers1

2

You can control the order of operations in angular expressions by wrapping an expression in parentheses, just like you can in javascript.

If you have nested parentheses, they are executed before their containing parentheses, and it should all happen left to right.

<h3 data-ng-bind="('prefix.' + (data.type | actionType)) | localize "></h3>

mmm
  • 2,272
  • 3
  • 25
  • 41