user3772144
user3772144

Reputation: 101

Disable an icon based on condition in Angularjs

I have an icon in a td which i wan to disable based on condition :

<td colspan="2" style="text-align: center;"><span 
                                            ng-disabled="action.isActionInprogress"
                                            ng-click="showAction($event,action)"
                                            style="cursor: pointer;" class="glyphicon glyphicon-eye-open"                                           
                                            title="{{action.isActionInProgress ? 'Cannot View While Action In Progress' : 'Show Action'}}">

It shows the title (Cannot View While Action In Progress) but the icon doesn't get disabled. What am i missing?

Upvotes: 0

Views: 5854

Answers (1)

Jameel Moideen
Jameel Moideen

Reputation: 7931

wrap the span with a button and try. I don't think you can apply ng-disable for span directly. Else You have to dynamically apply style and prevent the click event to make span disable

<button class="btn"  ng-disabled="action.isActionInprogress"  ng-click="showAction($event,action)"><span class="glyphicon glyphicon-eye-open" ></span></button>

Use CSS to make a span not clickable

Upvotes: 1

Related Questions