Skip to content

Instantly share code, notes, and snippets.

@guilhermehn
Last active December 18, 2015 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilhermehn/5731713 to your computer and use it in GitHub Desktop.
Save guilhermehn/5731713 to your computer and use it in GitHub Desktop.
AngularJS ngDisabled directive
angular.module('app', [])
.directive('ngDisabled', [function(){
return {
restrict: 'A',
link: function(scope, element, attrs){
if(scope.$eval(attrs.ngDisabled)){
element.attr('disabled', 'disabled');
}
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment