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

1 Answer 1

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>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.