-
Book Overview & Buying
-
Table Of Contents
Angular Projects - Fourth Edition
By :
We need a camera to scan a QR code and read its contents. Web browsers can interact with a camera device using JavaScript native APIs. The Media Streams API provides suitable methods for working with streamed video data, such as a live camera feed. However, it does not support QR codes out of the box.
In this chapter, we will use the ngx‑scanner‑qrcode Angular library that provides a convenient way to open the camera and read the value from a QR code. The library is an Angular wrapper for native APIs that eliminates much of the boilerplate required to interact with the camera.
We will create a component that will be responsible for scanning items and adding them to a picking list:
ng generate component picking
app.routes.ts file and add the following import statement:
import { Picking } from './picking/picking';