feat(bootstrap): changed bootstrap to return ComponentRef
This commit is contained in:
@ -79,7 +79,7 @@ export class DynamicComponentLoader {
|
||||
}
|
||||
|
||||
_componentAppInjector(location, injector, services) {
|
||||
var inj = isPresent(injector) ? injector : location.elementInjector.getLightDomAppInjector();
|
||||
var inj = isPresent(injector) ? injector : location.injector;
|
||||
return isPresent(services) ? inj.createChild(services) : inj;
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,15 @@ export class ElementRef {
|
||||
}
|
||||
|
||||
get hostView() {
|
||||
return this.elementInjector.getHostView();
|
||||
return this.elementInjector._preBuiltObjects.view;
|
||||
}
|
||||
|
||||
get injector() {
|
||||
return this.elementInjector._lightDomAppInjector;
|
||||
}
|
||||
|
||||
get boundElementIndex() {
|
||||
return this.elementInjector.getBoundElementIndex();
|
||||
return this.elementInjector._proto.index;
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,21 +612,11 @@ export class ElementInjector extends TreeNode {
|
||||
return this._getDirectiveByKeyId(Key.get(type).id) !== _undefined;
|
||||
}
|
||||
|
||||
hasPreBuiltObject(type:Type):boolean {
|
||||
var pb = this._getPreBuiltObjectByKeyId(Key.get(type).id);
|
||||
return pb !== _undefined && isPresent(pb);
|
||||
}
|
||||
|
||||
/** Gets the NgElement associated with this ElementInjector */
|
||||
getNgElement() {
|
||||
return this._preBuiltObjects.element;
|
||||
}
|
||||
|
||||
/** Gets the View associated with this ElementInjector */
|
||||
getHostView() {
|
||||
return this._preBuiltObjects.view;
|
||||
}
|
||||
|
||||
getComponent() {
|
||||
if (this._proto._binding0IsComponent) {
|
||||
return this._obj0;
|
||||
@ -635,10 +629,6 @@ export class ElementInjector extends TreeNode {
|
||||
return this._dynamicallyCreatedComponent;
|
||||
}
|
||||
|
||||
getLightDomAppInjector() {
|
||||
return this._lightDomAppInjector;
|
||||
}
|
||||
|
||||
directParent(): ElementInjector {
|
||||
return this._proto.distanceToParent < 2 ? this.parent : null;
|
||||
}
|
||||
@ -699,10 +689,6 @@ export class ElementInjector extends TreeNode {
|
||||
return obj;
|
||||
}
|
||||
|
||||
getBoundElementIndex() {
|
||||
return this._proto.index;
|
||||
}
|
||||
|
||||
_getByDependency(dep:DirectiveDependency, requestor:Key) {
|
||||
if (isPresent(dep.eventEmitterName)) return this._buildEventEmitter(dep);
|
||||
if (isPresent(dep.propSetterName)) return this._buildPropSetter(dep);
|
||||
|
Reference in New Issue
Block a user