W3cubDocs

/Angular

Form

An interface implemented by FormGroupDirective and NgForm directives.

API

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

addControl

void

Add a control to this form.

@paramdirNgControl

The control directive to add to the form.

@returnsvoid

removeControl

void

Remove a control from this form.

@paramdirNgControl

: The control directive to remove from the form.

@returnsvoid

getControl

FormControl<any>

The control directive from which to get the FormControl.

@paramdirNgControl

: The control directive.

@returnsFormControl<any>

addFormGroup

void

Add a group of controls to this form.

@paramdirAbstractFormGroupDirective

: The control group directive to add.

@returnsvoid

removeFormGroup

void

Remove a group of controls to this form.

@paramdirAbstractFormGroupDirective

: The control group directive to remove.

@returnsvoid

getFormGroup

FormGroup<any>

The FormGroup associated with a particular AbstractFormGroupDirective.

@paramdirAbstractFormGroupDirective

: The form group directive from which to get the FormGroup.

@returnsFormGroup<any>

updateModel

void

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

@paramdirNgControl

: The control directive to update.

@paramvalueany

: The new value for the control.

@returnsvoid

Description

An interface implemented by FormGroupDirective and NgForm directives.

Only used by the ReactiveFormsModule and FormsModule.

Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/forms/Form