Angular 如何在前端显示Firestore中的数据

Angular 如何在前端显示Firestore中的数据,angular,firebase,Angular,Firebase,我想做一个测验,我有一个数据库,里面有很多问题,我想把它们显示在前端。我可以显示问题的id,但不能显示实际问题。这是typescript代码: if(this.questionNumber !== this.questions.length - 1){ this.questionNumber++; this.selectedQuestion = this.questions[this.questionNumber] console.log(this.s

我想做一个测验,我有一个数据库,里面有很多问题,我想把它们显示在前端。我可以显示问题的id,但不能显示实际问题。这是typescript代码:

    if(this.questionNumber !== this.questions.length - 1){
      this.questionNumber++;
      this.selectedQuestion = this.questions[this.questionNumber]
      console.log(this.selectedQuestion.payload.doc.id)
      this.questionAt++;
    }
    else{
      console.log("cant increase on selected array");
    }

  }
  previous(){
    if(this.questionNumber !== 0){
      this.questionNumber--;
      this.selectedQuestion = this.questions[this.questionNumber]
      console.log(this.selectedQuestion.payload.doc.id)
      this.questionAt--;
    }
    else{
      console.log("cant select -1 from an array");
    }

  }
我试图在以下代码中将其显示在id的位置:

 <div class="modal-header">
            <h3><span class="label label-warning" id="qid">{{questionAt}}/10</span> {{this.selectedQuestion.payload.doc.id}}</h3>
        </div>

{{questionAt}}/10{{this.selectedQuestion.payload.doc.id}

由于要在HTML中显示字符串(问题)数组,您可以执行以下操作:

<div *ngFor="let question of questions">
  {{ question.actualQuestion }}
</div>

{{question.actualQuestion}}

显然,用你喜欢的任何东西替换div。

把你的问题摆成一排你能创建一个stackblitz吗?@Ramesh添加了一个db@Electron我添加了一个dbhmm的图像,所以当您试图使用字符串插值显示问题时会发生什么