user2402107
user2402107

Reputation: 913

Disable pointer events on an img tag angularjs

I am relatively new to Angularjs and I am trying to figure out the most appropriate way to remove pointer events since ng-disable still allows a click event. This iswhat I have with no success:

html

  <img class="btn btn-primary" style="border: none; margin-top: 0px;"
             src="assets/img/test-22x22.png"
             ng-class="path !== '/begin' && path !== '/end'?{'pointer-events': 'none'}:{}">

Upvotes: 1

Views: 5630

Answers (2)

Don
Don

Reputation: 1334

You can use ng-style with your code:

<img class="btn btn-primary" style="border: none; margin-top: 0px;"
             src="assets/img/test-22x22.png"
             ng-style="path !== '/begin' && path !== '/end'?{'pointer-events': 'none'}:{}">

OR add class with some values like and use it

.no-pointer-class {
    cursor: not-allowed;
    pointer-events:none;
}

<img class="btn btn-primary" 
     style="border: none; margin-top: 0px;"
     src="assets/img/test-22x22.png"
     ng-class="{'no-pointer-class': (path !== '/begin' && path !== '/end')}">

Upvotes: 2

asghar
asghar

Reputation: 447

you can set cursor:not-allowed from css style for img element**<img style="cursor:not-allowed;">**

Upvotes: 0

Related Questions