- template code description:
Angular6 response form has two FormControl, indicating name and age:
name: < input type= "text" formControlName= "name" > < / div >
Age: < input type= "text" formControlName= "age" > < / div >- what I want to achieve:
.
when you open the page where the form is located, the instance of an entity class in this page has been assigned.
requires that when you open the page where the form is located, fill in the corresponding data in the instance
for example:
when you open the page where the form is located, instance = {name:" Zhang San", age:15}
, then the two input are filled in turn: Zhang San, 15- ask for help:
I don"t know if there is a clear description above, it is best to provide code, and if not, it is also good to provide ideas.
Thank you very much!
set the value of
formGroup
directly after theformGroup
is instantiated or assigned.instance = { name:'', age:15 } formGroup.patchValue({ name:instance.name, age:instance.age })
Previous: (webpack4) how to configure jquery? in vue.config.js
Next: The fetch return string in react contains a label on how to add react routing.
- what I want to achieve: