Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ng-barcode-detector

hirebarend750.0.18TypeScript support: included

A library using the Barcode Detection API implemented in Chrome 83.

angular, angular2, barcode-detector, barcode-reader, barcode-scanner, qr-code, qr-code-detector, qr-code-reader, qr-code-scanner

readme

ng-barcode-detector

A library using the Barcode Detection API implemented in Chrome 83.

The Barcode Detection API is a subset of the Shape Detection API which provides the ability to detect and decode barcodes in an image provided by script. The image may come from any type of image buffer source such as an image, video or canvas tag.

Some native platforms include built-in libraries for performing text detection and optical character recognition (OCR) in images. The availability of these libraries means that developers do not need to include a large third party library.

Demo

Installation

npm install --save ng-barcode-detector

Usage

import { NgBarcodeDetectorModule } from 'ng-barcode-detector';

@NgModule({
  imports: [NgBarcodeDetectorModule],
})
export class AppModule {}
<ng-barcode-detector (detect)="onDetect($event)"></ng-barcode-detector>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})
export class AppComponent {
  public onDetect(result: string): void {
    alert(result);
  }
}