docs(API): 翻译完了 ValidatorFn

This commit is contained in:
Zhicheng Wang 2018-09-05 10:08:10 +08:00
parent badf927f37
commit 9e40bf8e63
2 changed files with 38 additions and 2 deletions

View File

@ -94,8 +94,8 @@
[x] | core/SimpleChange | 0.18
[x] | core/SimpleChanges | 0.18
[x] | forms/NgSelectOption | 0.17
[ ] | common/PercentPipe | 0.17
[ ] | forms/ValidatorFn | 0.17
[x] | common/PercentPipe | 0.17
[x] | forms/ValidatorFn | 0.17
[ ] | http/RequestOptionsArgs | 0.17
[ ] | animations/animation | 0.17
[x] | common/NgSwitchCase | 0.16

View File

@ -21,8 +21,12 @@ export type ValidationErrors = {
/**
* An interface that can be implemented by classes that can act as validators.
*
*
*
* ## Usage
*
* ##
*
* ```typescript
* @Directive({
* selector: '[custom-validator]',
@ -64,8 +68,12 @@ export const CHECKBOX_REQUIRED_VALIDATOR: StaticProvider = {
* A Directive that adds the `required` validator to any controls marked with the
* `required` attribute, via the `NG_VALIDATORS` binding.
*
* `NG_VALIDATORS` `required` `required`
*
* ### Example
*
* ###
*
* ```
* <input name="fullName" ngModel required>
* ```
@ -104,8 +112,12 @@ export class RequiredValidator implements Validator {
* A Directive that adds the `required` validator to checkbox controls marked with the
* `required` attribute, via the `NG_VALIDATORS` binding.
*
* `NG_VALIDATORS` `required` `required`
*
* ### Example
*
* ###
*
* ```
* <input type="checkbox" name="active" ngModel required>
* ```
@ -126,6 +138,8 @@ export class CheckboxRequiredValidator extends RequiredValidator {
/**
* Provider which adds `EmailValidator` to `NG_VALIDATORS`.
*
* `EmailValidator` `NG_VALIDATORS`
*/
export const EMAIL_VALIDATOR: any = {
provide: NG_VALIDATORS,
@ -137,8 +151,12 @@ export const EMAIL_VALIDATOR: any = {
* A Directive that adds the `email` validator to controls marked with the
* `email` attribute, via the `NG_VALIDATORS` binding.
*
* `NG_VALIDATORS` `email` `email`
*
* ### Example
*
* ###
*
* ```
* <input type="email" name="email" ngModel email>
* <input type="email" name="email" ngModel email="true">
@ -179,8 +197,12 @@ export interface AsyncValidatorFn {
/**
* Provider which adds `MinLengthValidator` to `NG_VALIDATORS`.
*
* `MinLengthValidator` `NG_VALIDATORS`
*
* ## Example:
*
* ##
*
* {@example common/forms/ts/validators/validators.ts region='min'}
*/
export const MIN_LENGTH_VALIDATOR: any = {
@ -194,6 +216,8 @@ export const MIN_LENGTH_VALIDATOR: any = {
* `formControl`, or control with `ngModel` that also has a `minlength` attribute.
*
*
* `MinLengthValidator` `minlength` `formControlName`
* `formControl` `ngModel`
*/
@Directive({
selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
@ -231,8 +255,12 @@ export class MinLengthValidator implements Validator,
/**
* Provider which adds `MaxLengthValidator` to `NG_VALIDATORS`.
*
* `MaxLengthValidator` `NG_VALIDATORS`
*
* ## Example:
*
* ##
*
* {@example common/forms/ts/validators/validators.ts region='max'}
*/
export const MAX_LENGTH_VALIDATOR: any = {
@ -246,6 +274,8 @@ export const MAX_LENGTH_VALIDATOR: any = {
* `formControl`, or control with `ngModel` that also has a `maxlength` attribute.
*
*
* `MaxLengthValidator` `minlength` `formControlName`
* `formControl` `ngModel`
*/
@Directive({
selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
@ -294,8 +324,14 @@ export const PATTERN_VALIDATOR: any = {
* as the regex to validate Control value against. Follows pattern attribute
* semantics; i.e. regex must match entire Control value.
*
* `NG_VALIDATORS` `pattern` `pattern`
* 使
* `pattern`
*
* ### Example
*
* ###
*
* ```
* <input [name]="fullName" pattern="[a-zA-Z ]*" ngModel>
* ```