a zip code crypto-currency system good for red ONLY

validators.d.ts 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * @license
  3. * Copyright Google Inc. All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { InjectionToken } from '@angular/core';
  9. import { Observable } from 'rxjs/Observable';
  10. import { AsyncValidatorFn, ValidationErrors, Validator, ValidatorFn } from './directives/validators';
  11. import { AbstractControl } from './model';
  12. /**
  13. * Providers for validators to be used for {@link FormControl}s in a form.
  14. *
  15. * Provide this using `multi: true` to add validators.
  16. *
  17. * ### Example
  18. *
  19. * ```typescript
  20. * @Directive({
  21. * selector: '[custom-validator]',
  22. * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
  23. * })
  24. * class CustomValidatorDirective implements Validator {
  25. * validate(control: AbstractControl): ValidationErrors | null {
  26. * return {"custom": true};
  27. * }
  28. * }
  29. * ```
  30. *
  31. * @stable
  32. */
  33. export declare const NG_VALIDATORS: InjectionToken<(Function | Validator)[]>;
  34. /**
  35. * Providers for asynchronous validators to be used for {@link FormControl}s
  36. * in a form.
  37. *
  38. * Provide this using `multi: true` to add validators.
  39. *
  40. * See {@link NG_VALIDATORS} for more details.
  41. *
  42. * @stable
  43. */
  44. export declare const NG_ASYNC_VALIDATORS: InjectionToken<(Function | Validator)[]>;
  45. /**
  46. * Provides a set of validators used by form controls.
  47. *
  48. * A validator is a function that processes a {@link FormControl} or collection of
  49. * controls and returns a map of errors. A null map means that validation has passed.
  50. *
  51. * ### Example
  52. *
  53. * ```typescript
  54. * var loginControl = new FormControl("", Validators.required)
  55. * ```
  56. *
  57. * @stable
  58. */
  59. export declare class Validators {
  60. /**
  61. * Validator that requires controls to have a value greater than a number.
  62. *`min()` exists only as a function, not as a directive. For example,
  63. * `control = new FormControl('', Validators.min(3));`.
  64. */
  65. static min(min: number): ValidatorFn;
  66. /**
  67. * Validator that requires controls to have a value less than a number.
  68. * `max()` exists only as a function, not as a directive. For example,
  69. * `control = new FormControl('', Validators.max(15));`.
  70. */
  71. static max(max: number): ValidatorFn;
  72. /**
  73. * Validator that requires controls to have a non-empty value.
  74. */
  75. static required(control: AbstractControl): ValidationErrors | null;
  76. /**
  77. * Validator that requires control value to be true.
  78. */
  79. static requiredTrue(control: AbstractControl): ValidationErrors | null;
  80. /**
  81. * Validator that performs email validation.
  82. */
  83. static email(control: AbstractControl): ValidationErrors | null;
  84. /**
  85. * Validator that requires controls to have a value of a minimum length.
  86. */
  87. static minLength(minLength: number): ValidatorFn;
  88. /**
  89. * Validator that requires controls to have a value of a maximum length.
  90. */
  91. static maxLength(maxLength: number): ValidatorFn;
  92. /**
  93. * Validator that requires a control to match a regex to its value.
  94. */
  95. static pattern(pattern: string | RegExp): ValidatorFn;
  96. /**
  97. * No-op validator.
  98. */
  99. static nullValidator(c: AbstractControl): ValidationErrors | null;
  100. /**
  101. * Compose multiple validators into a single function that returns the union
  102. * of the individual error maps.
  103. */
  104. static compose(validators: null): null;
  105. static compose(validators: (ValidatorFn | null | undefined)[]): ValidatorFn | null;
  106. static composeAsync(validators: (AsyncValidatorFn | null)[]): AsyncValidatorFn | null;
  107. }
  108. export declare function toObservable(r: any): Observable<any>;