aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/compile.js
diff options
context:
space:
mode:
authorMax Martinsson2012-06-06 16:23:07 +0200
committerIgor Minar2012-06-08 16:07:15 -0700
commitfb99b539b4d851773b43f1564f7032adb157c0db (patch)
tree75cc5decf994bf4dd4c556c04f43381705317cd5 /src/ng/compile.js
parent10f80d7d2918f98262090b425ecc294d9518aa7e (diff)
downloadangular.js-fb99b539b4d851773b43f1564f7032adb157c0db.tar.bz2
fix($compile): correctly merge class attr for replace directives
Merging of interpolated class attribute from directive template with replace:true works Closes #1006
Diffstat (limited to 'src/ng/compile.js')
-rw-r--r--src/ng/compile.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js
index e1aba35b..1dbb63be 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -865,6 +865,7 @@ function $CompileProvider($provide) {
var srcAttr = src.$attr,
dstAttr = dst.$attr,
$element = dst.$$element;
+
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) != '$') {
@@ -874,10 +875,12 @@ function $CompileProvider($provide) {
dst.$set(key, value, true, srcAttr[key]);
}
});
+
// copy the new attributes on the old attrs object
forEach(src, function(value, key) {
if (key == 'class') {
safeAddClass($element, value);
+ dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
} else if (key == 'style') {
$element.attr('style', $element.attr('style') + ';' + value);
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {