2017-04-07 102 views
-1

我想将子组件的对象数据传递给父组件。如何将从子组件到父组件的数据对象

<section class="grey_bg"> 
<app-search></app-search> 
<table> 
    <tbody> 
     <tr *ngFor="let contest of contests"> 
      <td>{{contest.contest_date}}</td> 
      <td>{{contest.prize_pool}}</td> 
      <td>{{contest.points}}</td> 
      <td>${{contest.entry_fee}}</td> 
     </tr> 
    </tbody> 
</table> 

获得从子组件搜索组件已选定的应用搜索具有竞赛数据共享父和子组件之间的信息中可以找到

this.authService.getUserContests().subscribe(
    contests => { 
     this.contests = contests.data 

    } 
+0

鉴于信息不完整。提供迄今为止你做了什么? –

回答

1

最简单的方式处理数据由Angular团队提供的Cookbook

您应该关注的具体技术是通过EventEmitterOutput(),如所述。

相关问题