@vanpevi wrote:
Hi,
I would like to create a form where the form fields are named in the ngOnInit based on data id that arrives in the same ngOnInit:
I would like to use the id in the names of the fields… but no idea how to achieve that?!
Thanks for reading,
VngOnInit() {
this.customers = [
{“id”:“1”,“name”:“name1”}
,{“id”:“2”,“name”:“name2”}
,{“id”:“3”,“name”:“name3”}
,{“id”:“4”,“name”:“name4”} ];
this.validations_form = this.formBuilder.group({
amountwater_amt1 : new FormControl(’’,Validators.required)
,amountwater_amt2 : new FormControl(’’,Validators.required)
,amountwater_amt3 : new FormControl(’’,Validators.required)
,amountwater_amt4 : new FormControl(’’,Validators.required)
,amountwine_amt1 : new FormControl(’’,Validators.required)
,amountwine_amt2 : new FormControl(’’,Validators.required)
,amountwine_amt3 : new FormControl(’’,Validators.required)
,amountwine_amt4 : new FormControl(’’,Validators.required)
…
});}
Posts: 1
Participants: 1