fix(core): Run component disposal before destroyRootHostView() to avoid crash if change detection is triggered.

Closes #5226
This commit is contained in:
Alex Rickabaugh
2015-11-10 15:42:22 -08:00
parent 857bef9e4f
commit b22eddf1cb
2 changed files with 20 additions and 2 deletions

View File

@ -249,10 +249,10 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
var component = this._viewManager.getComponent(newLocation);
var dispose = () => {
this._viewManager.destroyRootHostView(hostViewRef);
if (isPresent(onDispose)) {
onDispose();
}
this._viewManager.destroyRootHostView(hostViewRef);
};
return new ComponentRef_(newLocation, component, type, injector, dispose);
});