ngx-formcontrol-errors-msgs
Version:
A directive for showing errors in Angular form controls on reactive forms
72 lines (71 loc) • 2.58 kB
TypeScript
import { OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
import { FormControl, FormControlName, FormGroupDirective } from '@angular/forms';
import { ErrorMessageComponentFactory } from './providers/error-msg-component-factory/error-msg-component-factory';
import { ErrorMsgParser, ErrorMsgParserService } from './providers/error-msg-parser';
import * as i0 from "@angular/core";
/**
* Allows ease way to display `ValidationErrors` in a form.
*
* @example
*
* ```typescript
* @Component({
* selector: 'app-form',
* standalone: true,
* imports: [FormcontrolErrorsDirective, ReactiveFormsModule],
* template: `
* <form [formGroup]="form">
* <div class="form-row">
* <label for="name">Name</label>
* <input id="name" type="text" formControlName="name" ngxFormcontrolErrors>
* </div>
* <div class="form-row">
* <label for="email">Email</label>
* <input id="email" type="email" formControlName="email" ngxFormcontrolErrors>
* </div>
* </form>
* `
* })
* export class AppComponent {
*
* form = this.formBuilder.group({
* name: ['', [Validators.required, Validators.maxLength(10)]],
* email: ['', [Validators.required, Validators.email]],
* });
*
* }
* ```
*
*/
export declare class FormcontrolErrorsDirective implements OnInit, OnDestroy {
private readonly viewContainerRef;
private readonly errorMsgParser;
private formGroup;
private readonly formControlName;
private readonly formControl;
private readonly customErrorMsgParser;
private readonly errorMessageComponentFactory?;
private errorInfoComponent;
private control;
private sub$;
private errorParser?;
/**
* @internal
*/
onBlur(): void;
constructor(viewContainerRef: ViewContainerRef, errorMsgParser: ErrorMsgParserService, formGroup: FormGroupDirective, formControlName: FormControlName, formControl: FormControl, customErrorMsgParser: ErrorMsgParser, errorMessageComponentFactory?: ErrorMessageComponentFactory | undefined);
/**
* @internal
*/
ngOnInit(): void;
/**
* @internal
*/
ngOnDestroy(): void;
/**
* @internal
*/
validataStatus(status: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<FormcontrolErrorsDirective, [null, null, null, { optional: true; host: true; }, { optional: true; host: true; }, { optional: true; }, { optional: true; }]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<FormcontrolErrorsDirective, "[ngxFormcontrolErrors]", never, {}, {}, never, never, true, never>;
}