diff --git a/packages/core/src/render3/node_manipulation.ts b/packages/core/src/render3/node_manipulation.ts index a7a0b13d44..2c1ed5c056 100644 --- a/packages/core/src/render3/node_manipulation.ts +++ b/packages/core/src/render3/node_manipulation.ts @@ -676,7 +676,12 @@ function getFirstNativeNode(lView: LView, tNode: TNode | null): RNode|null { return lContainer[NATIVE]; } } else if (tNodeType === TNodeType.ElementContainer || tNodeType === TNodeType.IcuContainer) { - return getFirstNativeNode(lView, tNode.child); + const elIcuContainerChild = tNode.child; + if (elIcuContainerChild !== null) { + return getFirstNativeNode(lView, elIcuContainerChild); + } else { + return getNativeByTNode(tNode, lView); + } } else { const componentView = findComponentView(lView); const componentHost = componentView[T_HOST] as TElementNode; diff --git a/packages/core/test/acceptance/view_insertion_spec.ts b/packages/core/test/acceptance/view_insertion_spec.ts index 090401d357..fadc44211c 100644 --- a/packages/core/test/acceptance/view_insertion_spec.ts +++ b/packages/core/test/acceptance/view_insertion_spec.ts @@ -327,6 +327,11 @@ describe('view insertion', () => { .toBe('insert|before'); }); + it('should insert before a view with the empty ng-container as the first root node', () => { + expect(createAndInsertViews(`|before`).textContent) + .toBe('insert|before'); + }); + it('should insert before a view with ICU container inside a ng-container as the first root node', () => { expect(