AngularJS: Is there a convenient way to show and bind an element if a value is defined?

I'm looking for one line syntax for this:

<span ng-if="value">{{value}}</span>

      

Maybe something like:

<span ng-bind-if="value"></span>

      

+3


source to share


1 answer


If character retention is important, I would recommend creating a custom directive and handling the internal logic.



<span my-hide-if-undefined="value"></span>

      

+3


source







All Articles