export class DynamicComponentLoader
export class DynamicComponentLoader
exported from angular2/core defined in angular2/src/core/linker/dynamic_component_loader.ts (line 87)
Service for instantiating a Component and attaching it to a View at a specified location.
Members
loadAsRoot(type: Type, overrideSelector: string, injector: Injector, onDispose?: () => void) : Promise<ComponentRef>
loadAsRoot(type: Type, overrideSelector: string, injector: Injector, onDispose?: () => void) : Promise<ComponentRef>
Creates an instance of a Component type and attaches it to the first element in the
platform-specific global view that matches the component's selector.
In a browser the platform-specific global view is the main DOM Document.
If needed, the component's selector can be overridden via overrideSelector.
You can optionally provide injector and this Injector will be used to instantiate the
Component.
To be notified when this Component instance is destroyed, you can also optionally provide
onDispose callback.
Returns a promise for the ComponentRef representing the newly created Component.
#
Resulting DOM:
loadIntoLocation(type: Type, hostLocation: ElementRef, anchorName: string, providers?: ResolvedProvider[]) : Promise<ComponentRef>
loadIntoLocation(type: Type, hostLocation: ElementRef, anchorName: string, providers?: ResolvedProvider[]) : Promise<ComponentRef>
Creates an instance of a Component and attaches it to a View Container located inside of the Component View of another Component instance.
The targeted Component Instance is specified via its hostLocation ElementRef. The
location within the Component View of this Component Instance is specified via anchorName
Template Variable Name.
You can optionally provide providers to configure the Injector provisioned for this
Component Instance.
Returns a promise for the ComponentRef representing the newly created Component.
#
Resulting DOM:
loadNextToLocation(type: Type, location: ElementRef, providers?: ResolvedProvider[]) : Promise<ComponentRef>
loadNextToLocation(type: Type, location: ElementRef, providers?: ResolvedProvider[]) : Promise<ComponentRef>
Creates an instance of a Component and attaches it to the View Container found at the
location specified as ElementRef.
You can optionally provide providers to configure the Injector provisioned for this
Component Instance.
Returns a promise for the ComponentRef representing the newly created Component.
#
Resulting DOM:
<my-app>Parent</my-app>
<child-component>Child</child-component>