New to Kendo UI for Angular? Start a free 30-day trial
createBarcodeValidator
Creates a validator for a specific Barcode type.
Use this function to validate a Barcode value for a given BarcodeType
.
typescript
const control = new FormControl('1234', createBarcodeValidator('EAN8'));
console.log(control.errors);
// {
// barcode: {
// message: 'The value of the "EAN13" encoding should be 12 symbols',
// value: '1234',
// type: 'EAN13'
// }
// }
Parameters
type
Specifies the type of the Barcode.
size?
Size
Specifies the size of the barcode, excluding the text label, padding, and border. This parameter is optional.
Returns
ValidatorFn
Returns a validator function. The function returns an error map with the `barcode` property if validation fails. Otherwise, it returns `null` if valid.