Angular 2 output from router-outlet

后端 未结 4 2084
野的像风
野的像风 2020-11-29 01:05

I want to make navigation from child components that render inside router-outlet. My parent component have a router config and I want to navigate manually on some event. But

4条回答
  •  既然无缘
    2020-11-29 01:40

    is just a placeholder for adding routed components. There is no support for any kind of binding.

    You can create a custom that allows you to do that or more common, use a shared service to communicate between parent component and routed component.

    For more details see https://angular.io/docs/ts/latest/cookbook/component-communication.html

    update

    There is now an event that allows to get the added component

    
    

    which allows to communicate (call getters, setters, and methods) with the component in componentAdded()

    A shared service is the preferred way though.

提交回复
热议问题