Skip to content
Luiz Machado edited this page Apr 21, 2018 · 11 revisions

You can use some very cool attributes if you want:

<zxing-scanner
    [scannerActive]="scannerActive"
    [device]="selectedDevice"
    [cssClass]="'small-video'"
    (camerasFound)="displayCameras($event)"
    (scanSuccess)="handleQrCodeResult($event)"
></zxing-scanner>

Also, you can reference the component from the template and do awesome things in the script side:

// <zxing-scanner #scanner></zxing-scanner>

import { ViewChild } from '@angular/core';

export class AppComponent {

   @ViewChild('scanner')
   scanner: ZxingScannerComponent;

   doSomething(): void {
      this.scanner.device = this.getBackCamera();
   }

}
Clone this wiki locally