@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>
52 lines (51 loc) • 1.73 kB
TypeScript
import { AfterViewInit } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { NgxErrorsBase } from './errors-base.directive';
import * as i0 from "@angular/core";
/**
* Directive to hook into the errors of a given control.
*
* Example:
*
* ```ts
* \@Component({
* template: `
* <div [ngxErrors]="myControl">
* <div ngxError="required">This input is required</div>
* </div>
* `
* })
* export class MyComponent {
* myControl = new FormControl('', Validators.required)
* }
* ```
* In case the `ngxErrors` directive is a child of a [formGroup], you can specify
* the control by the control name similarly how you'd do it with formControlName:
*
* ```ts
* \@Component({
* template: `
* <form [formGroup]="form">
* <div ngxErrors="firstName">
* <div ngxError="required">This input is required</div>
* </div>
* </form>
* `
* })
* export class MyComponent {
* form = this.fb.group({
* firstName: ['', Validators.required]
* });
* constructor(private fb: FormBuilder) {}
* }
* ```
*/
export declare class ErrorsDirective extends NgxErrorsBase implements AfterViewInit {
controlInput: import("@angular/core").InputSignal<string | AbstractControl<any, any>>;
resolvedControl: import("@angular/core").Signal<AbstractControl<any, any> | undefined>;
private afterViewInitComplete;
ngAfterViewInit(): void;
private isAbstractControl;
static ɵfac: i0.ɵɵFactoryDeclaration<ErrorsDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ErrorsDirective, "[ngxErrors]", ["ngxErrors"], { "controlInput": { "alias": "ngxErrors"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
}