我想从我的路由组件接收事件并将数据从父组件传递到它们中。Angular2路由器插座组件事件发送(A2> = v1.2.0)
内容的应用程序,模板:
<router-outlet [data]='data' (selected)="selected($event)"></router-outlet> //this is not working
A“内容的应用程序”组件应该接收来自路由组件事件(如“内容的应用程序清单”)
<content-app> // this is where the events should arrive
<content-app-header></content-app-header>
<router-outlet></router-outlet>
<content-app-list></content-app-list> //this is a routed component, that emits events and should bind data
</content-app>
我可以实现处理数据的服务,但我更喜欢框架概念。
父注射工作。我在父项中实现了一个注册功能,以便让路由的子项可以让父项调用功能。 – marcel