mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix(compile): Initialize interpolated attributes before directive linking
This commit is contained in:
parent
2ed53087d7
commit
bb8448c011
2 changed files with 4 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}));
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue