This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

RouterOutlet

Acts as a placeholder that Angular dynamically fills based on the current router state.

See more...

NgModule

Selectors

Properties

Property Description
@Output('activate')
activateEvents: EventEmitter<any>
@Output('deactivate')
deactivateEvents: EventEmitter<any>
isActivated: boolean Read-only.
component: Object Read-only.
activatedRoute: ActivatedRoute Read-only.
activatedRouteData: Data Read-only.

Template variable references

Identifier Usage
outlet #myTemplateVar="outlet"

Description

      
      <router-outlet></router-outlet>
<router-outlet name='left'></router-outlet>
<router-outlet name='right'></router-outlet>
    

A router outlet will emit an activate event any time a new component is being instantiated, and a deactivate event when it is being destroyed.

<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
      
      <router-outlet
  (activate)='onActivate($event)'
  (deactivate)='onDeactivate($event)'></router-outlet>
    

Methods

ngOnDestroy(): void
      
      ngOnDestroy(): void
    

Parameters

There are no parameters.

Returns

void

ngOnInit(): void
      
      ngOnInit(): void
    

Parameters

There are no parameters.

Returns

void

Called when the RouteReuseStrategy instructs to detach the subtree

detach(): ComponentRef<any>
      
      detach(): ComponentRef<any>
    

Parameters

There are no parameters.

Returns

ComponentRef<any>

Called when the RouteReuseStrategy instructs to re-attach a previously detached subtree

      
      attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute)
    

Parameters

ref

Type: ComponentRef.

activatedRoute

Type: ActivatedRoute.

deactivate(): void
      
      deactivate(): void
    

Parameters

There are no parameters.

Returns

void

      
      activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | null)
    

Parameters

activatedRoute

Type: ActivatedRoute.

resolver

Type: ComponentFactoryResolver | null.