diff --git a/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts b/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts
index 7af0b8f..32c02a2 100644
--- a/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts
+++ b/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts
@@ -11,8 +11,7 @@ import { NgForm } from '@angular/forms';
styleUrls: ['./single-choice.component.css']
})
export class SingleChoiceComponent implements OnInit, OnDestroy {
- @Input()
- question;
+ private _question;
private answer;
@Output() emitNextQuestionRequest = new EventEmitter();
private id;
@@ -46,15 +45,26 @@ export class SingleChoiceComponent implements OnInit, OnDestroy {
}, 1000);
}
- ngOnInit() {
+ public get question() {
+ return this._question;
+ }
+
+ @Input('question')
+ public set question(data) {
+ this._question = data;
+ this.ngOnDestroy();
this.timeLeft = this.question.time;
if (this.timeLeft > 0) {
this.startTimer();
}
}
+ ngOnInit() {}
+
ngOnDestroy() {
- clearInterval(this.interval);
+ if (this.interval) {
+ clearInterval(this.interval);
+ }
if (this.verifyAnswerSubscription) {
this.verifyAnswerSubscription.unsubscribe();
}
diff --git a/FrontEnd/src/app/tests/test-details/question-view/true-false/true-false.component.html b/FrontEnd/src/app/tests/test-details/question-view/true-false/true-false.component.html
index 154392f..05e1631 100644
--- a/FrontEnd/src/app/tests/test-details/question-view/true-false/true-false.component.html
+++ b/FrontEnd/src/app/tests/test-details/question-view/true-false/true-false.component.html
@@ -1,5 +1,5 @@
- {{question.question}} ({{question.points}}pkt.)
0">Czas: {{ timeLeft }} sek. Czas: bez limitu
+ {{question.question}} ({{question.points}}pkt.)
0">Czas: {{ timeLeft }} sek. Czas: bez limitu