2017-07-17 72 views
1

enter image description hereAngular firebase 2如何根据父节点中的父按键获取所有子节点?

您好,我是相当新的火力点,我想创建一个游戏的调度应用程序,我有两个集合一个用于存储的比赛细节和另一个用于存储游戏细节,每场比赛中有比赛ID 。我想知道如何通过比赛id找出所有比赛。

我检查了firebase文档,但未能找到正确的文档。请向我指出任何有关这些场景的文档。

回答

1

您必须将tourID存储在tournamentID内。它会像这样流口水。

{ 
    "games": { 
    "game01": { 
     "team1": "X country", 
     "team2": "Y country", 
     "tournament": "tounament01" 
    }, 
    "game02": { 
     "team1": "X country", 
     "team2": "Y country", 
     "tournament": "tounament01" 
    } 
    }, 
    "tournaments": { 
    "tournament01": { 
     "tournamentName": "WorldCup", 
     "sport": "cricket", 
     "gameList": { 
     "game01": { 
      "gameid": "game01" 
     }, 
     "game02": { 
      "gameid": "game02" 
     } 
     } 
    } 
    } 
} 

我希望它有帮助。快乐编码:D