how do I generate different forms based on the data passed in the background? Such as user registration and user login, dynamic generation of form components?
how do I generate different forms based on the data passed in the background? Such as user registration and user login, dynamic generation of form components?
globally define a FormGroup
,
and then dynamically add FormControl
to FormGroup
based on different data.
public formGroup: FormGroup;
this.xxxService.getData().subscribe((data: Array<string>) => {
this.formGroup = new FormGroup({});
data.forEach((key: string) => {
this.formGroup.addControl(key, new FormControl(''));
});
});
to see the response form
you can use form-create to dynamically create form forms based on parameters, supporting check box, radio box, input box, drop-down selection box and other elements, as well as, provinces and cities three-level linkage, time selection, date selection, color selection, file / picture upload function. github address
Previous: How does OData break through the limits of Pagesize?
Next: Where should I read when building a hexo project, hexo d deployment with github page?
some scenarios are encountered during the development process using the angular4 framework. for example: there is a global drop-down list in the common component, and every time the value of the drop-down list changes, all activated subcomponents change...
at present, the project business is progressing steadily, and there is some independent time to learn. I have read some articles on front-end burying points, and I also have a theoretical understanding of the three schemes of manual burying points visu...
< H2 > problem scenario < H2 > The child component is referenced in the parent component, as follows: app.html <app-parent> <app-child>< app-child> < app-parent> I want to get the parent component or child component i...
smooth animation can be achieved normally using the following code in js. animate () { requestAnimationFrame (animate); TWEEN.update (); } animate (); use Times error in angular as follows: animate () { this.animate = this.animate.bind (this); ...