2016-12-27 68 views
0

我想使用此查询从火力地堡得到一个结果回:嵌套查询在3个楼层

// Get all Tipps 
    getAll(match: String): Observable<any> { 
    let filter: Object = { query: { orderByChild: 'match', equalTo: match } }; 
    return this.loginService.af.database.list('/tipps/', filter).map((tipps) => { 
     return tipps.map((tipp) => { 
     tipp.matchsub = this.loginService.af.database.object("/matches/" + tipp.match).map((matches) => { 
      return matches.map((match) => { 
      match.team1sub = this.loginService.af.database.object("/teams/" + match.team1); 
      match.team2sub = this.loginService.af.database.object("/teams/" + match.team2); 
      return match; 
      }) 
     }); 
     return tipp; 
    }); 
    }); 
    } 

我不知道如果这样做,因为第二级是什么应该,已可观察到的,我不能查看输出。

我使用这个代码在我的模板来获取数据了:

<div class="match_container" *ngFor="let tipp of tippsmodelview; let i = index;"> 
    <div class="matchbody-col3"> 
    {{(tipp.matchsub.team2sub | async)?.teamname}} 
    </div> 
</div> 

输出不显示错误,但它也不起作用。谁能给我一个提示显示第三级数据的提示?

回答

0

我会说尝试重新构建您的Firebase数据库 - 因为您已经深入3层以获取一些数据,它应该更平坦。

+0

谢谢,但这种选择真的不可能与firebase?与SQL它将是一个非常简单的选择与2内连接.. –