I need to set a value in a nested control in a FormBuiler and the model is the following:
this.addAccForm = this.fb.group({
accid: ['', Validators.required],
status: '',
cyc: this.fb.array([
this.initCyc(),
])
})
initCyc() {
return this.fb.group({
cycid: ['', Validators.required],
name: ['', Validators.required],
description: ['', Validators.required],
status: ['', Validators.required],
det: this.fb.group({
dcycid: ['', Validators.required],
status: ['', Validators.required]
})
})
I need to set a value cycid and also dcycid but I m stuck to it, I've tried to use the following line , but it does NOT help :
this.addAccForm.patchValue({cyc: { [0]: {cycid: 1234567 }}});
//
this.addAccForm.patchValue({cyc: { [0]: { det : {dcycid: 9876543}}}});
Any idea how it should be?
^6.0.0
– Borer