-1
I using relative forms at angular 4, I’m having trouble controlling setValidators in somewhat large structure, like below:
this.criteria = this.formBuilder.group({
discount: this.formBuilder.group({
percentage: [null],
amount: [null],
}),
});
That’s the way I’m doing it to control it. However, when there are more than two "nos" the control does not work, giving the following error: Property 'control' does not exist on type 'Abstractcontrol'. ts(2339)
this.criteria.controls['discount.percentage'].setValidators([Validators.required]);