fix(dynamic_component_loader): check whether the dynamically loaded component has already been destroyed

Fixes #2748
Closes #2767
This commit is contained in:
Tobias Bosch
2015-06-29 10:03:14 -07:00
parent da4de21f28
commit d6cef88dd8
2 changed files with 37 additions and 2 deletions

View File

@ -73,7 +73,9 @@ export class DynamicComponentLoader {
var dispose = () => {
var index = viewContainer.indexOf(hostViewRef);
viewContainer.remove(index);
if (index !== -1) {
viewContainer.remove(index);
}
};
return new ComponentRef(newLocation, component, dispose);
});