Skip to main content
Version: 0.8.0

notInList

The value must not be one of the given numbers. The control value is coerced numerically; non-numeric values pass.

Signature

NguardValidators.Number.notInList(...values: number[]): ValidatorFn
ParameterTypeDescription
...valuesnumber[]The disallowed values

Reactive forms

import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';

new FormControl('', [NguardValidators.Number.notInList(0, 13)]);

Template-driven forms

<input ngModel name="floor" [nguardNumberNotInList]="[0, 13]" />
<input ngModel name="floor" [nguardNumberNotInList]="13" />

Error key

{ notInList: true }

Notes

  • Numeric coercion. A non-numeric value is not in the numeric list, so it passes.

See also