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.

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.

See also

Exported from

Selectors

  • :not([type=checkbox])[required][formControlName]
  • :not([type=checkbox])[required][formControl]
  • :not([type=checkbox])[required][ngModel]

Properties

Property Description
@Input()
required: boolean | string

Tracks changes to the required attribute bound to this directive.

Description

Adding a required validator using template-driven forms

      
      <input name="fullName" ngModel required>