Doopler Doopler - 7 months ago 33
HTML Question

How to create if statement to handle a empty string in html

I am looking to create a case to say something else if my string is empty, how can I do that?

<div class="padding" id="dealBorder">
<pre id="informationDealText"><pan class="inner-pre" style="font-size: 24px; color: white;" ><font face="times new roman">{{data.$value}}</font></span></pre>



You're looking to use ng-if - very straightforward to use - it evaluates if the statement you pass it is true and renders the element accordingly.


     .inline-styles-are-bad {
       color: 'white';
       font-size: 22px;
     .font-tags-are-worse {
       font-family: 'times new roman', serif; /* bless your users */
<pre id="#someID">
 <span class="inline-styles-are-bad font-tags-are-worse" ng-if="data.value.length > 0">{{data.value}}</span>
 <span ng-if="data.value.length == 0">Something else</span>