Skip to main content
Version: 0.9.0

ean

The value must be a valid EAN-8 or EAN-13 barcode (check digit verified).

Signature

NguardValidators.String.ean: ValidatorFn

Reactive forms

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

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

Template-driven forms

<input ngModel name="barcode" nguardEan />

Error key

{ ean: true }

Notes

  • The value must be exactly 8 or 13 digits; the final digit is verified as the standard check digit.

See also

  • isbn — ISBN (ISBN-13 is an EAN)