fix(core): don’t detach nested view containers when destroying a view

When a view is destroyed, we destroy all
views in view containers and should not detach them. However, previously, we also detached them which lead to problems during the iteration loop.

Closes #8458
Closes #8471

Introduced by 0c600cf6e3
This commit is contained in:
Tobias Bosch
2016-05-04 11:53:12 -07:00
parent b30ddfbfc5
commit e2b1e1577d
3 changed files with 37 additions and 10 deletions

View File

@ -192,13 +192,7 @@ export abstract class AppView<T> {
ObservableWrapper.dispose(this.subscriptions[i]);
}
this.destroyInternal();
if (this._hasExternalHostElement) {
this.renderer.detachView(this.flatRootNodes);
} else if (isPresent(this.viewContainerElement)) {
this.viewContainerElement.detachView(this.viewContainerElement.nestedViews.indexOf(this));
} else {
this.dirtyParentQueriesInternal();
}
this.dirtyParentQueriesInternal();
this.renderer.destroyView(hostElement, this.allNodes);
}