Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page 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
    
Parameters
dir NgControl

The control directive to add to the form.

Returns

void

Remove a control from this form.

      
      removeControl(dir: NgControl): void
    
Parameters
dir NgControl
Returns

void

The control directive from which to get the FormControl.

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

FormControl

Add a group of controls to this form.

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

void

Remove a group of controls to this form.

      
      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
    
Parameters
dir NgControl
value any
Returns

void