Conditional filter

I have a tel filter that I like to apply only if the condition occurs. How can i do this?

This is my current code:

<span class="display-block" ng-show="event.category == 'Entry' && v" ng-repeat="(k, v) in properties"> <strong>{{k | sentenceCase}}:</strong> {{v | tel}} </span> 
+5
source share
2 answers

Try using the ternary operator in the same way as in JS:

 {{ condition ? (v | tel) : v }} 
+5
source
 <strong>{{k | condition?filterByThisIfTrue |orFilterByThis}}:</strong> 
0
source

Source: https://habr.com/ru/post/1239696/


All Articles