diff --git a/projects/common/form.service.ts b/projects/common/form.service.ts index 7739d45ba012ca06519e57af79a7794e1aae5c5b..fee0fd0fc1794450b14433dcf795033ee7869ef2 100644 --- a/projects/common/form.service.ts +++ b/projects/common/form.service.ts @@ -42,6 +42,6 @@ export class FormService { } setValidators(validations: FormControlValidators): void { - Promise.resolve().then(() => this._validatorsAdded.next(validations)); + this._validatorsAdded.next(validations); } } diff --git a/projects/player/src/app/components/form.component.ts b/projects/player/src/app/components/form.component.ts index cfcf2de00c24e87776f1051777cbe32b8b921c7f..9d7bc0e298f89f07a8b26ba3d732afe2c3461323 100644 --- a/projects/player/src/app/components/form.component.ts +++ b/projects/player/src/app/components/form.component.ts @@ -1,5 +1,5 @@ import { - Component, Input, OnDestroy, OnInit + ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core'; import { FormArray, FormBuilder, FormGroup } from '@angular/forms'; import { Subject } from 'rxjs'; @@ -39,7 +39,8 @@ export class FormComponent implements OnInit, OnDestroy { private veronaSubscriptionService: VeronaSubscriptionService, private veronaPostService: VeronaPostService, private messageService: MessageService, - private translateService: TranslateService) { + private translateService: TranslateService, + protected changeDetectorRef: ChangeDetectorRef) { } ngOnInit(): void { @@ -77,6 +78,7 @@ export class FormComponent implements OnInit, OnDestroy { private setValidators = (validators: FormControlValidators): void => { validators.formGroup.controls[validators.id].setValidators(validators.validators); validators.formGroup.controls[validators.id].updateValueAndValidity(); + this.changeDetectorRef.detectChanges(); }; private onNavigationDenied(message: VopNavigationDeniedNotification): void {