ApplicationRef
interface
A reference to an Angular application running on a page.
interface ApplicationRef { componentTypes: Type<any>[] components: ComponentRef<any>[] isStable: Observable<boolean> viewCount bootstrap<C>(componentOrFactory: ComponentFactory<C> | Type<C>, rootSelectorOrNode?: string | any): ComponentRef<C> tick(): void attachView(viewRef: ViewRef): void detachView(viewRef: ViewRef): void }
Properties
Property | Description |
---|---|
componentTypes: Type<any>[] |
Read-only. Get a list of component types registered to this application. This list is populated even before the component is created. |
components: ComponentRef<any>[] |
Read-only. Get a list of components registered to this application. |
isStable: Observable<boolean> |
Read-only. Returns an Observable that indicates when the application is stable or unstable. |
viewCount |
Read-only. Returns the number of attached views. |
Methods
bootstrap() | ||||
---|---|---|---|---|
Bootstrap a new component at the root level of the application. | ||||
|
componentOrFactory | Type: |
rootSelectorOrNode | Type: Optional. Default is |
Returns
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.
Optionally, a component can be mounted onto a DOM element that does not match the componentType's selector.
Example
@Component({selector: 'my-app', template: 'Hello World'}) class MyApp { } const myPlatformFactory = createPlatformFactory(platformBrowserDynamic, 'myPlatform'); myPlatformFactory().bootstrapModule(MyApp);
tick() |
---|
Invoke this method to explicitly process change detection and its side-effects. |
|
In development mode, |
attachView() | ||
---|---|---|
Attaches a view so that it will be dirty checked. The view will be automatically detached when it is destroyed. This will throw if the view is already attached to a ViewContainer. | ||
|
viewRef | Type: |
Returns
void
detachView() | ||
---|---|---|
Detaches a view from dirty checking again. | ||
|
viewRef | Type: |
Returns
void
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/core/ApplicationRef