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?
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.