RouterOutletContract
An interface that defines the contract for developing a component outlet for the Router
.
interface RouterOutletContract {
isActivated: boolean
component: Object | null
activatedRouteData: Data
activatedRoute: ActivatedRoute | null
activateEvents?: EventEmitter<unknown>
deactivateEvents?: EventEmitter<unknown>
attachEvents?: EventEmitter<unknown>
detachEvents?: EventEmitter<unknown>
supportsBindingToComponentInputs?: true
activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector): void
deactivate(): void
detach(): ComponentRef<unknown>
attach(ref: ComponentRef<unknown>, activatedRoute: ActivatedRoute): void
}
Class implementations
See also
Description
An outlet acts as a placeholder that Angular dynamically fills based on the current router state.
A router outlet should register itself with the Router
via
ChildrenOutletContexts#onChildOutletCreated
and unregister with
ChildrenOutletContexts#onChildOutletDestroyed
. When the Router
identifies a matched Route
,
it looks for a registered outlet in the ChildrenOutletContexts
and activates it.
Properties
Property | Description |
---|---|
isActivated: boolean
|
Whether the given outlet is activated. An outlet is considered "activated" if it has an active component. |
component: Object | null
|
The instance of the activated component or |
activatedRouteData: Data
|
The |
activatedRoute: ActivatedRoute | null
|
The |
activateEvents?: EventEmitter<unknown>
|
Emits an activate event when a new component is instantiated |
deactivateEvents?: EventEmitter<unknown>
|
Emits a deactivate event when a component is destroyed. |
attachEvents?: EventEmitter<unknown>
|
Emits an attached component instance when the |
detachEvents?: EventEmitter<unknown>
|
Emits a detached component instance when the |
supportsBindingToComponentInputs?: true
|
Read-Only
Used to indicate that the outlet is able to bind data from the When this is |
Methods
activateWith() | ||||||
---|---|---|---|---|---|---|
Called by the |
||||||
Parameters
Returns
|
deactivate() |
---|
A request to destroy the currently activated component. |
ParametersThere are no parameters. Returns
|
When a |
detach() |
---|
Called when the |
This is similar to |
attach() | ||||||
---|---|---|---|---|---|---|
Called when the |
||||||
Parameters
Returns
|