Form

FormGroupDirectiveNgForm 实现的接口。

An interface implemented by FormGroupDirective and NgForm directives.

查看"说明"...

      
      interface Form {
  addControl(dir: NgControl): void
  removeControl(dir: NgControl): void
  getControl(dir: NgControl): FormControl
  addFormGroup(dir: AbstractFormGroupDirective): void
  removeFormGroup(dir: AbstractFormGroupDirective): void
  getFormGroup(dir: AbstractFormGroupDirective): FormGroup
  updateModel(dir: NgControl, value: any): void
}
    

说明

只用于 ReactiveFormsModuleFormsModule 中。

Only used by the ReactiveFormsModule and FormsModule.

方法

把控件添加到该表单中。

Add a control to this form.

addControl(dir: NgControl): void
      
      addControl(dir: NgControl): void
    
参数
dir NgControl

要添加到表单中的控件指令。

The control directive to add to the form.

返回值

void

从该表单中移除控件。

Remove a control from this form.

removeControl(dir: NgControl): void
      
      removeControl(dir: NgControl): void
    
参数
dir NgControl
返回值

void

根据表单控件指令找到相应的 FormControl

The control directive from which to get the FormControl.

getControl(dir: NgControl): FormControl
      
      getControl(dir: NgControl): FormControl
    
参数
dir NgControl
返回值

FormControl

往该表单中添加一组控件。

Add a group of controls to this form.

addFormGroup(dir: AbstractFormGroupDirective): void
      
      addFormGroup(dir: AbstractFormGroupDirective): void
    
参数
dir AbstractFormGroupDirective
返回值

void

从该表单中移除一组控件。

Remove a group of controls to this form.

removeFormGroup(dir: AbstractFormGroupDirective): void
      
      removeFormGroup(dir: AbstractFormGroupDirective): void
    
参数
dir AbstractFormGroupDirective
返回值

void

与指定的 AbstractFormGroupDirective 相关的 FormGroup

The FormGroup associated with a particular AbstractFormGroupDirective.

把指定控件的表单模型修改为新的值。

Update the model for a particular control with a new value.

updateModel(dir: NgControl, value: any): void
      
      updateModel(dir: NgControl, value: any): void
    
参数
dir NgControl
value any
返回值

void