Search code examples
javascriptangularjsangularjs-scopeangular-ui

Angular ng-disabled with function


I want to use disabled-ng with dynamic value returned from a function.

I have tried several ways but it is not working.

<textarea id="{{exercise.type}}" ng-disabled={{prova}}></textarea>
......
<textarea id="{{exercise.type}}" ng-disabled=prova></textarea>
......
<textarea id="{{exercise.type}}" ng-disabled=prova()></textarea>

with this javascript function

$scope.prova=function(e){               
               return true;
       };

Solution

  • Try this syntax:

    ng-disabled="prova()"
    

    Example: http://jsfiddle.net/3eqz2/2/