ngx-input-errors
Version:
The ngx-input-errors library provides dynamic error messages for Angular Forms validations and automatic error extraction for displaying error messages.
46 lines (45 loc) • 2.05 kB
TypeScript
import { ElementRef } from '@angular/core';
import { AbstractControl, FormGroup } from '@angular/forms';
import { ErrorMessages } from './provider';
import * as i0 from "@angular/core";
export declare class NgxInputErrors {
private readonly config;
private el;
message: string;
private errorMessages;
controlName: string;
displayName: string;
language: string;
set form(form: FormGroup);
inValid: boolean;
constructor(config: ErrorMessages, el: ElementRef<HTMLParagraphElement>);
/**
* set error message language and
* get error messages from config file
*/
initializeErrorMessageFromConfigFile(): void;
/**
* set error message language to display
*/
setErrorMessageLanguage(): void;
getErrorMessagesFromConfigFile(): void;
/**
* check the form control state
* @param formControl reactive form formControl
*/
checkFormControlValidation(formControl: AbstractControl): void;
/**
* this function extract the reactive form validation errors from our custom error message with different languages
* @param errorMessages the error messages object is for define our showing user input error
* @param errors the value of errors in input object that define in form
* @param language the language of the error that we want to extract
* @param displayName the display input name for user
*/
extractError(errorMessages: {
[language: string]: {
[error: string]: any;
};
}, errors: any, language: string, displayName: string): any;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputErrors, [{ optional: true; }, null]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxInputErrors, "[ngxInputErrors]", never, { "controlName": { "alias": "controlName"; "required": false; }; "displayName": { "alias": "displayName"; "required": false; }; "language": { "alias": "language"; "required": false; }; "form": { "alias": "form"; "required": false; }; }, {}, never, never, true, never>;
}