Skip to content

Instantly share code, notes, and snippets.

@paomian
Created October 20, 2014 06:13
Show Gist options
  • Select an option

  • Save paomian/94ac313ad31a5760896b to your computer and use it in GitHub Desktop.

Select an option

Save paomian/94ac313ad31a5760896b to your computer and use it in GitHub Desktop.
my disabled
tableApp.directive('myDisabled', function($compile) {
return {
restrict: 'A',
replace: true,
scope: {
myDisabled: '='
},
link: function(scope, element, attrs) {
// console.log(attrs.myDisabled);
// console.log(typeof(attrs.myDisabled));
var test = scope.$eval(attrs.myDisabled);
console.log(test);
// console.log(scope.page);
scope.$watch(attrs.myDisabled, function (test) {
if (test) {
element.attr();
}
else {
element.attr('disabled', 'false');
}
});
// if (!test) {
// element.attr('disabled', 'disabled');
// }
// $compile(attrs);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment