• Overview
@angular/router

ROUTER_OUTLET_DATA

constant

An InjectionToken provided by the RouterOutlet and can be set using the routerOutletData input.

Description

An InjectionToken provided by the RouterOutlet and can be set using the routerOutletData input.

When unset, this value is null by default.

Usage Notes

To set the data from the template of the component with router-outlet:

          
<router-outlet [routerOutletData]="{name: 'Angular'}" />

To read the data in the routed component:

          
data = inject(ROUTER_OUTLET_DATA) as Signal<{name: string}>;
Jump to details