Skip to main content
Version: 0.8.0

notEqualTo

The value must not be exactly equal to the given string (strict equality).

Signature

NguardValidators.String.notEqualTo(value: string): ValidatorFn
ParameterTypeDescription
valuestringThe value the field must not equal

Reactive forms

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

new FormControl('', [NguardValidators.String.notEqualTo('default')]);

Template-driven forms

<input ngModel name="name" [nguardStringNotEqualTo]="'default'" />

Error key

{ notEqualTo: true }

Notes

  • Uses strict inequality (!==).

See also