javascript - Angular.js ternery statement on HTML tag -
class="lang-html prettyprint-override"> <h4 class="changecolor">{{driver.name}} </h4> <h4 class="changecolor" ng-show="!driver.name">{{driver.officeemail}} </h4>
if driver.name
not available show driver.officeemail
is there way implement in 1 line, using ternary statement?
if want utilize 1 binding, try:
<h4 class="changecolor">{{driver.name || driver.officeemail}}</h4>
this called short-circuit evaluation. if driver.name
undefined, driver.officeemail
shown instead.
javascript angularjs
No comments:
Post a Comment