-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: routerfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration
Milestone
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
I want a simple way to pass data into "router-outlet" child components
Proposed solution
@Component({
selector : 'main',
template : `<router-outlet [data]="data"></router-outlet>`
})
export class MainComponent {
data = 'test';
}Retrive the data into the routed component
import {ROUTER_DATA, Component, Inject } from '@angular/core';
@Component({
selector: 'child',
template: `{{data}}`
})
export class ChildComponent {
constructor(@Inject(ROUTER_DATA) public data: any) { }
}Alternatives considered
Nothing
anshumankmr, MathewBerg, piotrroda, ChellappanRajan, nigrosimone and 36 moreK-RutviK-K, Endhen, mdarif, mo-ba and efi-azEndhen
Metadata
Metadata
Assignees
Labels
area: routerfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration