aboutsummaryrefslogtreecommitdiffstats
path: root/src/directives.js
diff options
context:
space:
mode:
authorMisko Hevery2010-12-01 20:29:54 -0800
committerMisko Hevery2010-12-02 22:45:57 -0800
commit5a8ad8fe329fc09898ff43a060710265d38393be (patch)
tree95058036d40b1dd993e2a9c4094ebd34b2751707 /src/directives.js
parent41d5938883a3d06ffe8a88a51efd8d1896f7d747 (diff)
downloadangular.js-5a8ad8fe329fc09898ff43a060710265d38393be.tar.bz2
Closes #170. Corrected the behavior of select when options are ng:repeated
- Delete $postEval method, as it was a hack
Diffstat (limited to 'src/directives.js')
-rw-r--r--src/directives.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/directives.js b/src/directives.js
index 8a76f17a..d40d6120 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -304,7 +304,8 @@ angularDirective("ng:bind-template", function(expression, element){
var REMOVE_ATTRIBUTES = {
'disabled':'disabled',
'readonly':'readOnly',
- 'checked':'checked'
+ 'checked':'checked',
+ 'selected':'selected'
};
/**
* @workInProgress
@@ -359,27 +360,31 @@ var REMOVE_ATTRIBUTES = {
angularDirective("ng:bind-attr", function(expression){
return function(element){
var lastValue = {};
- var updateFn = element.parent().data('$update');
+ var updateFn = element.data($$update) || noop;
this.$onEval(function(){
- var values = this.$eval(expression);
+ var values = this.$eval(expression),
+ dirty = noop;
for(var key in values) {
var value = compileBindTemplate(values[key]).call(this, element),
specialName = REMOVE_ATTRIBUTES[lowercase(key)];
if (lastValue[key] !== value) {
lastValue[key] = value;
if (specialName) {
- if (element[specialName] = toBoolean(value)) {
- element.attr(specialName, value);
+ if (toBoolean(value)) {
+ element.attr(specialName, specialName);
+ element.attr('ng-' + specialName, value);
} else {
- element.removeAttr(key);
+ element.removeAttr(specialName);
+ element.removeAttr('ng-' + specialName);
}
- (element.data('$validate')||noop)();
+ (element.data($$validate)||noop)();
} else {
element.attr(key, value);
}
- this.$postEval(updateFn);
+ dirty = updateFn;
}
}
+ dirty();
}, element);
};
});