This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

Form

An interface implemented by FormGroupDirective and NgForm directives.

See more...

      
      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
}
    

Class implementations

Description

Only used by the ReactiveFormsModule and FormsModule.

Methods

Add a control to this form.

addControl(dir: NgControl): void
      
      addControl(dir: NgControl): void
    

Parameters

dir

The control directive to add to the form.

Returns

void

Remove a control from this form.

removeControl(dir: NgControl): void
      
      removeControl(dir: NgControl): void
    

Parameters

dir

Type: NgControl.

Returns

void

The control directive from which to get the FormControl.

getControl(dir: NgControl): FormControl
      
      getControl(dir: NgControl): FormControl
    

Parameters

dir

Type: NgControl.

Returns

FormControl

Add a group of controls to this form.

addFormGroup(dir: AbstractFormGroupDirective): void
      
      addFormGroup(dir: AbstractFormGroupDirective): void
    

Parameters

dir

Type: AbstractFormGroupDirective.

Returns

void

Remove a group of controls to this form.

removeFormGroup(dir: AbstractFormGroupDirective): void
      
      removeFormGroup(dir: AbstractFormGroupDirective): void
    

Parameters

dir

Type: AbstractFormGroupDirective.

Returns

void

The FormGroup associated with a particular AbstractFormGroupDirective.

      
      getFormGroup(dir: AbstractFormGroupDirective): FormGroup
    

Parameters

dir

Type: AbstractFormGroupDirective.

Returns

FormGroup

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

updateModel(dir: NgControl, value: any): void
      
      updateModel(dir: NgControl, value: any): void
    

Parameters

dir

Type: NgControl.

value

Type: any.

Returns

void