RequiredValidator

RequiredValidator

Stable Directive

Class Overview

class RequiredValidator implements Validator {
  required : boolean|string
  validate(c: AbstractControl) : ValidationErrors|
}

Selectors

:not([type=checkbox])[required][formControlName]

:not([type=checkbox])[required][formControl]

:not([type=checkbox])[required][ngModel]

Class Description

A Directive that adds the required validator to any controls marked with the required attribute, via the NG_VALIDATORS binding.

Example

<input name="fullName" ngModel required>

Class Details

required : boolean|string
validate(c: AbstractControl) : ValidationErrors|

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

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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部