Help Angular by taking a 1 minute survey!Go to surveyHome

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 NgControl

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 NgControl
Returns

void

The control directive from which to get the FormControl.

getControl(dir: NgControl): FormControl
      
      getControl(dir: NgControl): FormControl
    
Parameters
dir NgControl
Returns

FormControl

Add a group of controls to this form.

addFormGroup(dir: AbstractFormGroupDirective): void
      
      addFormGroup(dir: AbstractFormGroupDirective): void
    
Parameters
dir AbstractFormGroupDirective
Returns

void

Remove a group of controls to this form.

removeFormGroup(dir: AbstractFormGroupDirective): void
      
      removeFormGroup(dir: AbstractFormGroupDirective): void
    
Parameters
dir AbstractFormGroupDirective
Returns

void

The FormGroup associated with a particular AbstractFormGroupDirective.

      
      getFormGroup(dir: AbstractFormGroupDirective): FormGroup
    
Parameters
dir 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 NgControl
value any
Returns

void