AngularJS ng-disabled – conditionally disable an element

AngularJS directive ng-disabled sets the disabled attribute on the element if the expression ng-disabled evaluates to true.

<div ng-app="myApp" ng-controller='MyCtrl'>
  <label>Select checkbox to disable: <input type="checkbox" ng-model="disableButton"></label><br/>
  <button ng-model="button1" ng-disabled="disableButton">Button</button>

<script src="//"></script>
  var module = angular.module('myApp', []);
  module.controller('MyCtrl', function($scope) {});
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments