diff options
| -rw-r--r-- | src/ng/compile.js | 2 | ||||
| -rw-r--r-- | test/ng/compileSpec.js | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js index 13f8ae7e..18adc2c9 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -938,7 +938,7 @@ function $CompileProvider($provide) { } directives.unshift(derivedSyncDirective); - afterTemplateNodeLinkFn = applyDirectivesToNode(directives, $compileNode, tAttrs, childTranscludeFn); + afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn); afterTemplateChildLinkFn = compileNodes($compileNode.contents(), childTranscludeFn); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index b4ec0292..a7707cf9 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -1538,6 +1538,25 @@ describe('$compile', function() { expect(element.text()).toEqual('WORKS'); }); }); + + it('should support $observe inside link function on directive object', function() { + module(function() { + directive('testLink', valueFn({ + templateUrl: 'test-link.html', + link: function(scope, element, attrs) { + attrs.$observe( 'testLink', function ( val ) { + scope.testAttr = val; + }); + } + })); + }); + inject(function($compile, $rootScope, $templateCache) { + $templateCache.put('test-link.html', '{{testAttr}}' ); + element = $compile('<div test-link="{{1+2}}"></div>')($rootScope); + $rootScope.$apply(); + expect(element.text()).toBe('3'); + }); + }); }); |
