javascript - Disable select in Angular? -


on page located html select list:

<select ng-model="names" disabled="{{disabled}}" name="names" class="form-control input-medium">

and in controller:

$scope.disabled = true; 

and ng-change:

$scope.changespecialization = function (id){     console.log(id); // gives value more 0     if(id > 0){       $scope.disabled = false;     } } 

how can see in method changespecialization catch id , check zero. console returns me value more zero. after changed $scope.disabled false. on page select list still disabled.

you should use ngdisabled directive.

this directive sets disabled attribute on element if expression inside ngdisabled evaluates truthy.

code example

<select ng-disabled="disabled" ng-model="names" name="names"> </select> 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -