W3cubDocs

/Angular 4 TypeScript

Validators

Stable Class

Class Overview

class Validators {
  static required(control: AbstractControl) : ValidationErrors|
}

Class Description

Provides a set of validators used by form controls.

A validator is a function that processes a FormControl or collection of controls and returns a map of errors. A null map means that validation has passed.

Example

var loginControl = new FormControl("", Validators.required)

Static Members

required(control: AbstractControl) : ValidationErrors|

Validator that requires controls to have a non-empty value.

exported from forms/index, defined in forms/src/validators.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/forms/index/Validators-class.html