I'm using angular and I need check id of each input. Is there any way to set id form each form input like this?
this.contactForm = this.formBuilder.group({
firstname: ['', {id: 1}],
lastname: ['', {id: 2}],
email: ['', {id: 3}]
)}
I'm using angular and I need check id of each input. Is there any way to set id form each form input like this?
this.contactForm = this.formBuilder.group({
firstname: ['', {id: 1}],
lastname: ['', {id: 2}],
email: ['', {id: 3}]
)}
Copyright © 2021 Jogjafile Inc.
Yes you can, but you shouldn't use the
FormGroupconfiguration for this.FormGrouphas no support for setting the id attribute.You can assign the id attribute of an input like this:
So you have to either hardcode the ids into the template, or use some other form of configuration than
FormGroupto get it from like a dictionary object.