Fix content projector after angular2 update

This commit is contained in:
Roman Hotsiy 2016-12-02 11:26:47 +02:00
parent 73ec40072d
commit 5c6d57ab2c
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -29,13 +29,13 @@ export class ContentProjector {
let parentCompRef = parentView.createComponent(componentFactory, null, contextInjector, [projectedNodes]);
// using private property to get AppElement instance
let appElement = (<any>parentView)._element;
appElement.nestedViews = appElement.nestedViews || [];
let viewContainer = (<any>parentView)._element;
viewContainer.nestedViews = viewContainer.nestedViews || [];
for (let i=0; i < componentRefs.length; i++) {
let compRef = componentRefs[i];
appElement.nestedViews.push((<any>compRef.hostView).internalView);
// attach appElement to parentView change detector
(<any>compRef.hostView).internalView.addToContentChildren(appElement);
// attach view to viewContainer change detector
viewContainer.nestedViews.push((<any>compRef.hostView).internalView);
(<any>compRef.hostView).internalView.viewContainer = viewContainer;
}
return parentCompRef;
}