equalTo
The value must be exactly equal to the given string (strict equality).
Signature
NguardValidators.String.equalTo(value: string): ValidatorFn
| Parameter | Type | Description |
|---|---|---|
value | string | The value the field must equal |
Reactive forms
import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';
new FormControl('', [NguardValidators.String.equalTo('ACCEPTED')]);
Template-driven forms
<input ngModel name="confirmation" [nguardStringEqualTo]="'ACCEPTED'" />
Error key
{ equalTo: true }
Notes
- Uses strict equality (
===); a value of a different type fails. - For matching another field, use
String.sameinstead.
See also
notEqualTo— opposite intent