как получить дочерние данные от Firebase в angular 8 - PullRequest
0 голосов
/ 27 января 2020

Это JSON данные, которые я хочу получить дочерние данные из базы данных реального времени firebase в angular.

"Batch" : {
  "DEC2019" : {
    "141" : {
      "Name" : "Dhanashree Patil",
        "Session" : {
          "15-01-2020" : {
           "Duration" : "01:37",
             "Objection" : {
               "taken" : [ {
                 "desc" : "",
                 "eid" : "144",
                 "result" : "+100",
                 "type" : "Factual Inconsistancy"
                } ]
            },
      "Score" : "00",
      "Topic" : "dufhjuv"
     }
    }

Как получить топи c сеанса и тип возражения?

user.service.ts

 getTpoics(){
   return this.af.database.ref(this.ref).child(this.batch)
 }

component.ts

 topis : any[] =[];

 ngOnInit() {
          this.userservice.getTpoics().on('value',snapshot =>{
     snapshot.forEach(data =>{
     data.forEach(item=>{
       this.topis.push(item.val());
     })
   })
   console.log("Toics: ",snapshot.key, this.topis)
 })
}
...