javascript events - How can I make an image link unclickable using AngularJS? -


I have an image that has an action with it (by ng-click):

  & lt; a href = "#" ng-click = "doSomething ($ Event)" & gt; & Lt; img src = "myImage.png" & gt; & Lt; / A & gt;   

In some circumstances, I do not like it (and is deeply, but I can worry about it). Essentially the use of NG-Disabled / Enabled (which will not work, due to disablement is not the property of anchor elements) is equal. In this way (replacing a more complex expression for "true"):

  & lt; a href = "#" ng-click = "doSomething ($ event)" ng-disabled = "true" & gt; & Lt; Img src = "myImage.png" & gt; & Lt; / A & gt;   

Is there any way to do this?

Please check that the demo

you use only one director ng-class You can 'obscure' the link with the CSS, using only one directive ng-class

  a.disabled {pointer-events: none; Cursor: default; Opacity: 0.5} a.enable {Opacity: 1}   

HTML:

  & lt; a href = "" ng-click = "doSomething ($ Event)" ng-class = "{'Enable': Enable, 'disabled':!)" & gt; & Lt; img src = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQDlD8Xc_e4xZJeDGlyHF3KkeKibtex6qXwGzlM_w_-7WV-NRPf" /> & Lt; / A & gt;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -