export class ApplicationRef
export class ApplicationRef
exported from angular2/core defined in angular2/src/core/application_ref.ts (line 279)
A reference to an Angular application running on a page.
For more about Angular applications, see the documentation for bootstrap
.
Members
registerBootstrapListener(listener: (ref: ComponentRef) => void) : void
registerBootstrapListener(listener: (ref: ComponentRef) => void) : void
Register a listener to be called each time bootstrap()
is called to bootstrap
a new root component.
registerDisposeListener(dispose: () => void) : void
registerDisposeListener(dispose: () => void) : void
Register a listener to be called when the application is disposed.
bootstrap(componentType: Type, providers?: Array<Type | Provider | any[]>) : Promise<ComponentRef>
bootstrap(componentType: Type, providers?: Array<Type | Provider | any[]>) : Promise<ComponentRef>
Bootstrap a new component at the root level of the application.
Bootstrap process
When bootstrapping a new root component into an application, Angular mounts the specified application component onto DOM elements identified by the [componentType]'s selector and kicks off automatic change detection to finish initializing the component.
Optional Providers
Providers for the given component can optionally be overridden via the providers
parameter. These providers will only apply for the root component being added and any
child components under it.
#
injector : Injector
injector : Injector
Retrieve the application Injector
.
zone : NgZone
zone : NgZone
Retrieve the application NgZone
.
dispose() : void
dispose() : void
Dispose of this application and all of its components.
tick() : void
tick() : void
Invoke this method to explicitly process change detection and its side-effects.
In development mode, tick()
also performs a second change detection cycle to ensure that no
further changes are detected. If additional changes are picked up during this second cycle,
bindings in the app have side-effects that cannot be resolved in a single change detection
pass.
In this case, Angular throws an error, since an Angular application can only have one change
detection pass during which all change detection must complete.
componentTypes : Type[]
componentTypes : Type[]
Get a list of component types registered to this application.