herum-shared 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1408,13 +1408,13 @@ class QuizMultiAnswerQuestionComponent {
1408
1408
  }
1409
1409
  ngOnChanges(changes) {
1410
1410
  if (changes['question'] && this.question) {
1411
- const isToInitializeFormControls = Object.keys(this.answersForm.controls).length && changes['question'].currentValue.id !== changes['question'].previousValue?.id;
1411
+ const isToInitializeFormControls = Object.keys(this.answersForm.controls).length > 0 && changes['question'].currentValue.id !== changes['question'].previousValue?.id;
1412
1412
  if (isToInitializeFormControls)
1413
1413
  this.answersForm = this.fb.group({});
1414
1414
  this.question.closedContent?.answers?.forEach((answer, index) => {
1415
1415
  const controlName = this.answerControlNamePrefix + index;
1416
1416
  this.answersForm.addControl(controlName, new FormControl(this.getFormControlValue(index)));
1417
- if (isToInitializeFormControls) {
1417
+ if (isToInitializeFormControls || changes['question'].isFirstChange()) {
1418
1418
  this.answersForm.get(controlName).valueChanges
1419
1419
  .pipe(takeUntil(this.destroySubject$))
1420
1420
  .subscribe((isChosen) => this._onAnswersChange(this.question.closedContent?.answers[index], isChosen));