What elements can ng-disabled apply to?

I thought I could apply ng-disabledto an element <a>. Looks like I can't. It works with an element <button>. Does anyone know which elements I can apply ng-disabledto?

+4
source share
2 answers

You cannot disable the anchor tag. The attribute ng-disabledor disabledonly works with an element button/input. If you want to disable the anchor tag, then you must call the function ng-clickon it, and then either redirect it or do nothing on it.

Markup

<a href="" ng-click="redirect(isValid, url)"> Anchor Button </a>

the code

$scope.redirect = function(isValid, url){
    if(isValid)
      $window.open(url, "_blank")
}
+3
source

For use in ngDisabled docs

<INPUT
  ng-disabled="expression">
...
</INPUT>

<input /> . , <button> <select> <textarea>. , , . .

+1

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


All Articles