aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ng/compile.js2
-rw-r--r--test/ng/compileSpec.js5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js
index 32c1d1ca..b7eb759b 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -1037,7 +1037,7 @@ function $CompileProvider($provide) {
interpolateFn = $interpolate(attr[name], true);
}
- attr[name] = undefined;
+ attr[name] = interpolateFn(scope);
($$observers[name] || ($$observers[name] = [])).$$inter = true;
(attr.$$observers && attr.$$observers[name].$$scope || scope).
$watch(interpolateFn, function interpolateFnWatchAction(value) {
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 3b69f609..da8f2f8c 100644
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -1381,9 +1381,10 @@ describe('$compile', function() {
}));
- it('should set interpolated attrs to undefined', inject(function($rootScope, $compile) {
+ it('should set interpolated attrs to initial interpolation value', inject(function($rootScope, $compile) {
+ $rootScope.whatever = 'test value';
$compile('<div some-attr="{{whatever}}" observer></div>')($rootScope);
- expect(directiveAttrs.someAttr).toBeUndefined();
+ expect(directiveAttrs.someAttr).toBe($rootScope.whatever);
}));