Angular span conditional tilt over text

I get 3 values ​​from the backend: isDone, isInProgress, isFailed and based on these 3 values, I need to change the hover over the text of the span element in angularview. if the element isDone or isInProgress, I have to show a single icon with 2 different hover texts. if the element isFailed, I should show an error message on the screen:

Code:

<span class="glyphicon glyphicon-refresh blue" title="In progress" ng-show="action.isInProgress"> </span> 

How to include IsDone in this range?

+5
source share
3 answers

Just do the following:

 <span class="glyphicon glyphicon-refresh blue" title="{{ action.isInProgress ? 'Action is in progress' : 'Action is complete.'}}" ng-show="action.isInProgress||action.isDone"></span> 
+4
source

You can use conditional checks

 <span class="glyphicon glyphicon-refresh blue" title=" Action is Complete" ng-if="action.isDone"> </span> <span class="glyphicon glyphicon-refresh blue" title="Action in progress" ng-if="action.isInProgress"> </span> 
+2
source

What about

 <span class="glyphicon glyphicon-refresh blue" title="{{status}}" > </span> 

and update the status variable depending on the value, since "In progress", or ..

+2
source

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


All Articles