fix(core): properly destroy embedded Views attatched to ApplicationRef (#13459)

Fixes #13062
This commit is contained in:
Pawel Kozlowski
2016-12-14 17:33:29 +01:00
committed by Victor Berchet
parent 94b7031fe9
commit d40bbf4d5c
2 changed files with 21 additions and 3 deletions

View File

@ -191,7 +191,8 @@ export abstract class AppView<T> {
} else {
this._renderDetach();
}
if (this.declaredViewContainer && this.declaredViewContainer !== this.viewContainer) {
if (this.declaredViewContainer && this.declaredViewContainer !== this.viewContainer &&
this.declaredViewContainer.projectedViews) {
const projectedViews = this.declaredViewContainer.projectedViews;
const index = projectedViews.indexOf(this);
// perf: pop is faster than splice!