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
Post a Comment