Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional filter

I have a tel filter which I will like to be applied only if a condition is meet. How can I do it?

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>
like image 714
victorhazbun Avatar asked Jan 02 '16 21:01

victorhazbun


1 Answers

Try to use ternary operator just like you would do in JS:

{{ condition ? (v | tel) : v }}
like image 104
dfsq Avatar answered Nov 11 '22 11:11

dfsq