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.

FormsModule

Exports the required providers and directives for template-driven forms, making them available for import by NgModules that import this module.

      
      class FormsModule {
  static withConfig(opts: { callSetDisabledState?: SetDisabledStateOption; }): ModuleWithProviders<FormsModule>
}
    

See also

Static methods

Provides options for configuring the forms module.

      
      static withConfig(opts: { callSetDisabledState?: SetDisabledStateOption; }): ModuleWithProviders<FormsModule>
    
Parameters
opts object

An object of configuration options

  • callSetDisabledState Configures whether to always call setDisabledState, which is more correct, or to only call it whenDisabled, which is the legacy behavior.
Returns

ModuleWithProviders<FormsModule>

Directives

NameDescription
      
      CheckboxControlValueAccessor
    

A ControlValueAccessor for writing a value and listening to changes on a checkbox input element.

      
      CheckboxRequiredValidator
    

A Directive that adds the required validator to checkbox controls marked with the required attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      DefaultValueAccessor
    

The default ControlValueAccessor for writing a value and listening to changes on input elements. The accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      EmailValidator
    

A directive that adds the email validator to controls marked with the email attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      MaxLengthValidator
    

A directive that adds maximum length validation to controls marked with the maxlength attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      MaxValidator
    

A directive which installs the MaxValidator for any formControlName, formControl, or control with ngModel that also has a max attribute.

      
      MinLengthValidator
    

A directive that adds minimum length validation to controls marked with the minlength attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      MinValidator
    

A directive which installs the MinValidator for any formControlName, formControl, or control with ngModel that also has a min attribute.

      
      NgControlStatus
    

Directive automatically applied to Angular form controls that sets CSS classes based on control status.

      
      NgControlStatusGroup
    

Directive automatically applied to Angular form groups that sets CSS classes based on control status (valid/invalid/dirty/etc). On groups, this includes the additional class ng-submitted.

      
      NgForm
    

Creates a top-level FormGroup instance and binds it to a form to track aggregate form value and validation status.

      
      NgModel
    

Creates a FormControl instance from a domain model and binds it to a form control element.

      
      NgModelGroup
    

Creates and binds a FormGroup instance to a DOM element.

      
      NgSelectOption
    

Marks <option> as dynamic, so Angular can be notified when options change.

      
      NumberValueAccessor
    

The ControlValueAccessor for writing a number value and listening to number input changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      PatternValidator
    

A directive that adds regex pattern validation to controls marked with the pattern attribute. The regex must match the entire control value. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      RadioControlValueAccessor
    

The ControlValueAccessor for writing radio control values and listening to radio control changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      RangeValueAccessor
    

The ControlValueAccessor for writing a range value and listening to range input changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      RequiredValidator
    

A directive that adds the required validator to any controls marked with the required attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

      
      SelectControlValueAccessor
    

The ControlValueAccessor for writing select control values and listening to select control changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.

      
      SelectMultipleControlValueAccessor
    

The ControlValueAccessor for writing multi-select control values and listening to multi-select control changes. The value accessor is used by the FormControlDirective, FormControlName, and NgModel directives.