What is the difference between angular responsive forms and template-driven forms?

what is the difference between angular responsive forms and template-driven forms, and what are their applicable scenarios?

Mar.19,2021

to put it simply, the template driver uses ngModel to bind controls to data, and Angular will listen for changes in values asynchronously. In our view, this is a black box operation that we can't control. The responsive form processes the value and state of the control in real time through FormControl and so on, and the controllability is greatly improved. Choose which one to see if you want the data to be controllable.


can be simply understood that responsive forms are dynamic and template-driven forms are static.

template-driven forms are suitable for fixed pages, such as login pages, and template-driven forms can be used.
responsive forms are suitable for dynamic pages, usually maintaining a formGroup . Any component that you want to add for verification, just bind a formControl , then add it to formGroup, and the next state can be obtained through formGroup.

for example, I click create user, then I need to open a dialog to specify the value of each field, and then validate it.
because the same dialog box will also be used to create tasks, create companies, etc., so this dialog box is dynamic, so you can't use templates to drive the form.
what should I do?
in the dialog component, I can create a formGroup formGroup: FormGroup = new FormGroup ()
and then use formGroup to add formControls for the field, in dialog

    this.formGroup.addControl('name', new FormControl())
    this.formGroup.addControl('age', new FormControl())
    this.formGroup.addControl('hobby', new FormControl())
    this.formGroup.addControl('gender', new FormControl())
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36cb0-2c056.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36cb0-2c056.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?