• 개요
@angular/router

ROUTER_OUTLET_DATA

상수
안정화

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

API

설명

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

When unset, this value is null by default.

사용 시 참고사항

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}>;
상세 내용으로 이동