【发布时间】:2019-07-31 22:30:33
【问题描述】:
While creating a reactive forms in angular we why we need to use formBuilder instead of FormGroup when we can make reactive forms using either of them.
Here i also provided what i am trying to ask
maintenanceForm: FormGroup;
ngOnInit() {
this.maintenanceForm = new FormGroup({
'value': new FormControl(null),
'dropdown': new FormControl(null)
})
}
/* 这里因为我们可以用这两种方式制作反应式表单,但是什么时候使用它们中的任何一种 */
this.maintenanceForm = this.formBuilder.group({
body_type_id: ['', Validators.required],
make_name: ['', Validators.required]
});
【问题讨论】:
标签: angular7 angular-reactive-forms