Question

Suppose if we have to modify or do some prepossessing on parameters of ui-sref like below:

ui-sref="post({postId: post.post_id, postTitle: post.post_title | myFilter )})"

As shown if I want to apply my custom filter to parameter, is there any way to it?

I have tried like above, but it didn't worked and was giving syntax color.

The other solution could be probably to modify attribute in controller only, but that it not feasible for me, as these data is coming from server in list and I don't think to pre-process it in controller is good idea just for this.

Any suggestions this can be achieved?

Was it helpful?

Solution

Yes you can, however you need to wrap each parameter in parenthesis like so:

ui-sref="post({postId: (post.post_id | myFilter), postTitle: (post.post_title | myFilter)})"

Example, using lowercase filter:

ui-sref="post({postId: (post.post_id | lowercase), postTitle: (post.post_title | lowercase)})"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top