2017-04-07 106 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(),如所述。

相關問題