UNPKG

@ngspot/ngx-errors

Version:

<p align="center"> <img width="20%" height="20%" src="https://github.com/DmitryEfimenko/ngspot/blob/main/packages/ngx-errors/package/assets/logo.png?raw=true"> </p>

25 lines (24 loc) 1.38 kB
import { InjectionToken, Provider } from '@angular/core'; import { LiteralUnionOrString } from './typings'; export type ShowErrorWhen = LiteralUnionOrString<'touched' | 'dirty' | 'touchedAndDirty' | 'formIsSubmitted'>; export interface IErrorsConfiguration { /** * Configures when to display an error for an invalid control. Options that are available by default are listed below. Note, custom options can be provided using CUSTOM_ERROR_STATE_MATCHERS injection token. * * `'touched'` - *[default]* shows an error when control is marked as touched. For example, user focused on the input and clicked away or tabbed through the input. * * `'dirty'` - shows an error when control is marked as dirty. For example, when user has typed something in. * * `'touchedAndDirty'` - shows an error when control is marked as both - touched and dirty. * * `'formIsSubmitted'` - shows an error when parent form was submitted. */ showErrorsWhenInput?: ShowErrorWhen; /** * The maximum amount of errors to display per ngxErrors block. */ showMaxErrors?: number | null; } export type ErrorsConfiguration = Required<IErrorsConfiguration>; export declare const ERROR_CONFIGURATION: InjectionToken<Required<IErrorsConfiguration>>; export declare function provideNgxErrorsConfig(config?: IErrorsConfiguration): Provider;