import {Component, OnDestroy, OnInit} from '@angular/core'; import {MinutePaperDao} from 'src/app/dao/minute-paper.dao'; import {QuestionDao} from 'src/app/dao/question.dao'; import {LecturerDataService} from 'src/app/services/lecturer-data.service'; import {LecturerInfoService} from 'src/app/services/lecturer-info.service'; @Component({ selector: 'app-lecturer-view-paper', templateUrl: './lecturer-view-paper.component.html', styleUrls: ['./lecturer-view-paper.component.css'] }) export class LecturerViewPaperComponent implements OnInit, OnDestroy { public currentPaper: MinutePaperDao; public questions: QuestionDao[]; constructor(private lecturerDataServce: LecturerDataService, private lecturerInfoService: LecturerInfoService) { } ngOnInit(): void { this.questions = []; this.currentPaper = this.lecturerDataServce.currentPaper; this.lecturerInfoService.getPaperQuestions(this.currentPaper.paperId).subscribe((data: QuestionDao[]) => { data.forEach(e => this.questions.push(e)); }); } ngOnDestroy(): void { this.questions = []; } }