diff --git a/src/ng/compile.js b/src/ng/compile.js index f89b97feee94..13d0488aa59a 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -997,6 +997,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { ? JQLitePrototype.clone.call(namespaceAdaptedCompileNodes) // IMPORTANT!!! : namespaceAdaptedCompileNodes; + if ( $linkNode.length === 0 && parentBoundTranscludeFn ) { + $linkNode = parentBoundTranscludeFn(scope); + } + if (transcludeControllers) { for (var controllerName in transcludeControllers) { $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 8fbb10b0cd99..f7d7fd1f4b95 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -4927,6 +4927,37 @@ describe('$compile', function() { }); + describe('collocated nested transcludes', function() { + + beforeEach(module(function($compileProvider) { + + $compileProvider.directive('inner', valueFn({ + restrict: 'E', + transclude: true, + template: '' + })); + + $compileProvider.directive('outer', valueFn({ + restrict: 'E', + transclude: true, + template: '' + })); + + })); + + + // Issue #8914 + it('should render nested transclusion at the root of a template', inject(function($compile, $rootScope) { + + element = $compile('
transcluded content
')($rootScope); + $rootScope.$digest(); + expect(element.text()).toEqual('transcluded content'); + + })); + + }); + + describe('nested transcludes', function() { beforeEach(module(function($compileProvider) {