diff --git a/lib/services/content-projector.service.ts b/lib/services/content-projector.service.ts index a02b58dc..0f87001b 100644 --- a/lib/services/content-projector.service.ts +++ b/lib/services/content-projector.service.ts @@ -29,13 +29,13 @@ export class ContentProjector { let parentCompRef = parentView.createComponent(componentFactory, null, contextInjector, [projectedNodes]); // using private property to get AppElement instance - let appElement = (parentView)._element; - appElement.nestedViews = appElement.nestedViews || []; + let viewContainer = (parentView)._element; + viewContainer.nestedViews = viewContainer.nestedViews || []; for (let i=0; i < componentRefs.length; i++) { let compRef = componentRefs[i]; - appElement.nestedViews.push((compRef.hostView).internalView); - // attach appElement to parentView change detector - (compRef.hostView).internalView.addToContentChildren(appElement); + // attach view to viewContainer change detector + viewContainer.nestedViews.push((compRef.hostView).internalView); + (compRef.hostView).internalView.viewContainer = viewContainer; } return parentCompRef; }