Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular js ng-disabled doesnt work

This is my form

<form name="myForm">
<input ng-disabled="true" type="text" >*
</form>

However I am trying to understand why this input field is not disabled?

I also tried with a $scope, so in the CTRL:

$scope.diss=true;

and in html :

<form name="myForm">
<input ng-disabled="diss" type="text" >*
</form>

It still doesnt work, any hint?

like image 375
user2038879 Avatar asked Feb 05 '13 09:02

user2038879


2 Answers

Here's a simple working example of the ng-disabled directive:

<form ng-app> 
   <input ng-disabled="checked" type="text" />
    Click me to disable: <input type="checkbox" ng-model="checked"><br/>
</form> 
like image 61
Ajay Beniwal Avatar answered Sep 21 '22 11:09

Ajay Beniwal


I could not use ng-disabled with angular prior to version 1.2.x (I am on 1.0.8) because my jQuery version was 1.4.2.

angularJS 1.0.x requires jQuery 1.6 or newer.

Upgrading either your jQuery or angularJS will fix the issue - angularJS 1.2.x detects your jQuery version and will fallback to its internal jQLite.

like image 33
Matt DeKrey Avatar answered Sep 18 '22 11:09

Matt DeKrey