Skip to content
Luiz Machado edited this page Apr 25, 2018 · 8 revisions

Installation

To install this package, run:

yarn add @zxing/ngx-scanner@latest

or

npm i @zxing/ngx-scanner@latest --save

Then import it into your Angular Module, see Usage.

Installation Problems

If you experience problems upon installing the component, please run

npm install --global --production windows-build-tools

and try again. If the problem still occurs, file an issue.

Usage

Import it on your module file:

// some.module.ts
import { NgModule } from '@angular/core';

// your very important imports here

// the scanner!
import { ZXingScannerModule } from '@zxing/ngx-scanner';

// your other nice stuff

@NgModule({
  imports: [ 
    // ...
    // gets the scanner ready!
    ZXingScannerModule,
    // ...
  ]
})
export class SomeModule {}

Put the component in the interface:

<!-- some.component.html -->
<zxing-scanner></zxing-scanner>

And that's it! 😉

Clone this wiki locally