mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
refactor(ng:bind-attr): simplify impl by leveraging jquery
This commit is contained in:
parent
f0f5ffa9aa
commit
66fdb36ecb
1 changed files with 2 additions and 11 deletions
|
|
@ -429,19 +429,10 @@ angularDirective("ng:bind-attr", function(expression){
|
|||
this.$watch(function(scope){
|
||||
var values = scope.$eval(expression);
|
||||
for(var key in values) {
|
||||
var value = compileBindTemplate(values[key])(scope, element),
|
||||
specialName = BOOLEAN_ATTR[lowercase(key)];
|
||||
var value = compileBindTemplate(values[key])(scope, element);
|
||||
if (lastValue[key] !== value) {
|
||||
lastValue[key] = value;
|
||||
if (specialName) {
|
||||
if (toBoolean(value)) {
|
||||
element.attr(specialName, specialName);
|
||||
} else {
|
||||
element.removeAttr(specialName);
|
||||
}
|
||||
} else {
|
||||
element.attr(key, value);
|
||||
}
|
||||
element.attr(key, BOOLEAN_ATTR[lowercase(key)] ? toBoolean(value) : value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue