fix(element_injector): do not throw when cannot find element when trying to report an error

This commit is contained in:
vsavkin 2015-07-22 17:16:03 -07:00
parent 70792c744d
commit 03c8e7428f
1 changed files with 4 additions and 2 deletions

View File

@ -496,8 +496,10 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
private _debugContext(): any {
var p = this._preBuiltObjects;
return new _Context(p.elementRef.nativeElement, p.view.getHostElement().nativeElement,
this._injector);
var element = isPresent(p.elementRef) ? p.elementRef.nativeElement : null;
var hostRef = p.view.getHostElement();
var componentElement = isPresent(hostRef) ? hostRef.nativeElement : null;
return new _Context(element, componentElement, this._injector);
}
private _reattachInjectors(imperativelyCreatedInjector: Injector): void {