简体   繁体   中英

How to hook into an angular component's events from a router-outlet

So typically, when you target an event of a component it usually looks like this:

<some-component (someEventEmitter)="doSomething($event)"></some-component>

My question is, how would you pass in paramater info to the component if it's being rendered by the router-outlet?

You wouldn't. If you want to get events from a component being rendered by the router, use some app wide service that you can use to subscribe and publish events through.

If you want to pass data into a component being rendered by the router, look at the queryParams and routeParams features that are part of the router.

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