import { AbstractControl, FormControl, ValidationErrors } from '@angular/forms'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; export interface ValidationResult { [key: string]: boolean; } interface AsyncValidatorFn { (c: AbstractControl): Promise | Observable; } export declare class NgxValidators { /** * Test if the input is number. * Allow only number or + or - or . * If not number, return isNumberError object. * */ static isNumber(control: FormControl): ValidationResult; /** * Test if the password strong enough. * Password should contain number and uppercase letter and lower case letter and length should more than 7 * If not strong enough, return strongPasswordError object. * */ static strongPassword(control: FormControl): ValidationResult; /** * Compare two password to validate if they are match * If not match, return matchPasswordError object. * */ static matchPassword(repeatPassword: string): (control: FormControl) => { matchPasswordError: boolean; }; /** * This control is required if the input control has value. * */ static requiredIfInputHasValue(inputControlName: string): (control: FormControl) => { required: boolean; }; /** * only allow letters/numbers * */ static numberLetterOnly(control: FormControl): ValidationResult; /** * only allow letters/numbers/space * */ static numberLetterSpaceOnly(control: FormControl): ValidationResult; /** * should not contain blank * */ static noBlank(control: FormControl): { [key: string]: boolean; }; /** * Validate from backend if this field is duplicate or not. * Input url string and HttpClient and the validator will get to your url, * if the response is equal to true -> not duplicate * if the response is not equal to true -> duplicate * */ static asyncDuplicate(url: string, http: HttpClient, expectValue: any): AsyncValidatorFn; /** * should not contain blank * */ static isUrl(control: FormControl): { [key: string]: boolean; }; } export {};