mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-14 17:53:11 +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){
|
this.$watch(function(scope){
|
||||||
var values = scope.$eval(expression);
|
var values = scope.$eval(expression);
|
||||||
for(var key in values) {
|
for(var key in values) {
|
||||||
var value = compileBindTemplate(values[key])(scope, element),
|
var value = compileBindTemplate(values[key])(scope, element);
|
||||||
specialName = BOOLEAN_ATTR[lowercase(key)];
|
|
||||||
if (lastValue[key] !== value) {
|
if (lastValue[key] !== value) {
|
||||||
lastValue[key] = value;
|
lastValue[key] = value;
|
||||||
if (specialName) {
|
element.attr(key, BOOLEAN_ATTR[lowercase(key)] ? toBoolean(value) : value);
|
||||||
if (toBoolean(value)) {
|
|
||||||
element.attr(specialName, specialName);
|
|
||||||
} else {
|
|
||||||
element.removeAttr(specialName);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
element.attr(key, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue