Issue
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.
Solution
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),
})
Answered By - Salmin Skenderovic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.