简体   繁体   中英

Displaying component with @Input in another component's router-outlet

I wanted to know if you guys know a way to display components that take a @Input directive inside of a router-outlet.

I have several components that takes in @Inputs and I would like to display these components dynamically in one component. I would like to design this one component container to be as abstract as possible, so it would be reusable and extendable in the future.

I'm trying to achieve something like

big-container.component has

<router-outlet name='container1'></router-outlet>

in which links to container1.component which contains

<container1 [settings]=mySettings></container1>

I would like to get container1.component to display in big-container.component's router-outlet with the [settings].

Thank you!

As this POST states it is currently not possible.

Here is the linked issue on Github

Use a shared service to communicate with components added by the router. For details see https://angular.io/docs/ts/latest/cookbook/component-communication.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM