createBarcodeValidator
Function
Definition
Package:@progress/kendo-angular-barcodes
Syntax:
TS
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'
// }
// }
Creates a validator for a specific Barcode type.
Use this function to validate a Barcode value for a given BarcodeType.
Parameters:typeBarcodeType
Specifies the type of the Barcode.
size?SizeSpecifies 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.