BuildCustomFields(formControl, formControlValue): FormGroup {
return this.fb.group({
formControl: new FormControl(formControlValue),
})
}
I need to add formControl
Value from parameter which I pass in BuildCustomFields()
method. How can pass the value of formControl
dynamically?
It always takes this text "formControl" as key instead of using value which I am passing to it.
If you want formControl to be your dynamic key, you need to pass reference it within []
otherwise you get the value of it
BuildCustomFields(formControl, formControlValue): FormGroup {
debugger
return this.fb.group({
[formControl]: new FormControl(formControlValue),
})