diff options
| author | Igor Minar | 2012-05-06 16:30:24 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-05-06 23:01:33 -0700 |
| commit | b24cc63bcbd45741d21757653f05d54db09e0f20 (patch) | |
| tree | 67e78e1f7f02c6ee779774ead671f8589dc0ab95 /src/ng/directive/booleanAttrs.js | |
| parent | 49dfdf8f0238ef8c473fcb44694f6b5696ecde70 (diff) | |
| download | angular.js-b24cc63bcbd45741d21757653f05d54db09e0f20.tar.bz2 | |
fix(ngSrc,ngHref): binding should set element prop as well as attr
IE9 ignores setAttribute('src', val) calls on img if "ng:src" attribute
is present. It only fetches the image if element property is updated as well.
Closes #935
Diffstat (limited to 'src/ng/directive/booleanAttrs.js')
| -rw-r--r-- | src/ng/directive/booleanAttrs.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js index 5da98ef4..1468008c 100644 --- a/src/ng/directive/booleanAttrs.js +++ b/src/ng/directive/booleanAttrs.js @@ -310,10 +310,16 @@ forEach(['src', 'href'], function(attrName) { attr.$$observers[attrName] = []; attr.$observe(normalized, function(value) { attr.$set(attrName, value); + + // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist + // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need + // to set the property as well to achieve the desired effect + if (msie) element.prop(attrName, value); }); } else { // value present means that no interpolation, so copy to native attribute. attr.$set(attrName, value); + element.prop(attrName, value); } }; } |
