Skip to main content
Version: 0.9.0

notEqualTo

The value must not equal the given number. The control value is coerced numerically; non-numeric values pass.

Signature​

NguardValidators.Number.notEqualTo(value: number): ValidatorFn
ParameterTypeDescription
valuenumberThe value the field must not equal

Reactive forms​

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

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

Template-driven forms​

<input ngModel name="quantity" [nguardNumberNotEqualTo]="0" />

Error key​

{ notEqualTo: true }

Notes​

  • Numeric coercion. A non-numeric value is not equal to the target, so it passes.

See also​