Skip to content

API Reference


API Reference / @dasch-ng/validators / UniqueValidatorDirective

Class: UniqueValidatorDirective ​

Defined in: unique/unique.validator.ts:36

Template-driven version of uniqueValidator. Re-validates when the list changes.

html
<input ngModel [validateUnique]="existingNames" caseInsensitive />

Implements ​

  • Validator

Constructors ​

Constructor ​

new UniqueValidatorDirective(): UniqueValidatorDirective

Defined in: unique/unique.validator.ts:42

Returns ​

UniqueValidatorDirective

Properties ​

caseInsensitive ​

readonly caseInsensitive: InputSignalWithTransform<boolean, unknown>

Defined in: unique/unique.validator.ts:38


existing ​

readonly existing: InputSignal<readonly unknown[] | null | undefined>

Defined in: unique/unique.validator.ts:37

Methods ​

registerOnValidatorChange() ​

registerOnValidatorChange(fn): void

Defined in: unique/unique.validator.ts:54

Parameters ​

fn ​

() => void

The callback function

Returns ​

void

Description ​

Registers a callback function to call when the validator inputs change.

Implementation of ​

Validator.registerOnValidatorChange


validate() ​

validate(control): ValidationErrors | null

Defined in: unique/unique.validator.ts:50

Parameters ​

control ​

AbstractControl

The control to validate against.

Returns ​

ValidationErrors | null

A map of validation errors if validation fails, otherwise null.

Description ​

Method that performs synchronous validation against the provided control.

Implementation of ​

Validator.validate

Released under the MIT License.