小编くにあ*_*にあつ的帖子

将@Output 与“angular 4.0”的 <router-outlet> 一起使用

使用选择器成功。

<app-child1 (onVoted)="onVoted($event)"></app-child1>
Run Code Online (Sandbox Code Playgroud)

但是使用路由器会失败

<router-outlet  (onVoted)="onVoted($event)"></router-outlet>
Run Code Online (Sandbox Code Playgroud)

我想从“路由器插座”上显示的组件接收一个值。

请告诉我我有什么方法。

应用程序?https://toparent.herokuapp.com/ src: https://github.com/kuniatsu/routerQuestion

<h1>
  {{title}}
</h1>
<a href="c1">child1</a>
<router-outlet  (onVoted)="onVoted($event)"></router-outlet><!--fail-->
<hr />
<app-child1 (onVoted)="onVoted($event)"></app-child1><!--success-->
Run Code Online (Sandbox Code Playgroud)

angular-components angular

5
推荐指数
1
解决办法
3659
查看次数

标签 统计

angular ×1

angular-components ×1