Merge pull request #252 from stianst/master
Fix form sometimes read-only on refresh
This commit is contained in:
commit
cec3df71ca
1 changed files with 13 additions and 6 deletions
|
@ -814,12 +814,19 @@ module.directive('kcReadOnly', function() {
|
||||||
var d = {
|
var d = {
|
||||||
replace : false,
|
replace : false,
|
||||||
link : function(scope, element, attrs) {
|
link : function(scope, element, attrs) {
|
||||||
if (scope.$eval(attrs.kcReadOnly)) {
|
scope.$watch(attrs.kcReadOnly, function(readOnly, oldValue) {
|
||||||
element.find('input').attr('disabled', 'disabled');
|
if (readOnly) {
|
||||||
element.find('button').attr('disabled', 'disabled');
|
element.find('input').attr('disabled', 'disabled');
|
||||||
element.find('select').attr('disabled', 'disabled');
|
element.find('button').attr('disabled', 'disabled');
|
||||||
element.find('textarea').attr('disabled', 'disabled');
|
element.find('select').attr('disabled', 'disabled');
|
||||||
}
|
element.find('textarea').attr('disabled', 'disabled');
|
||||||
|
} else {
|
||||||
|
element.find('input').removeAttr('disabled');
|
||||||
|
element.find('button').removeAttr('disabled');
|
||||||
|
element.find('select').removeAttr('disabled');
|
||||||
|
element.find('textarea').removeAttr('disabled');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return d;
|
return d;
|
||||||
|
|
Loading…
Reference in a new issue