ng2-qrcode is a simple Angular4 Component for generating QRCode It uses QRCode.js. QRCode.js supports Cross-browser with HTML5 Canvas and table tag in DOM.
npm install ng2-qrcode
import {Component, OnInit} from '@angular/core';
import {QRCodeComponent} from 'ng2-qrcode'
@Component({
selector: 'YourMainComponent',
directives: [QRCodeComponent],
template: `
<div>
<qrcode [qrdata]="'My QR code data string'" [size]="256" [level]="'M'"></qrcode>
</div>
`
})
Attribute | Type | Default | Description |
---|---|---|---|
qrdata | String | '' | String to encode |
size | Number | 256 | Height / Width |
level | String | 'M' | QR Correction level ('L', 'M', 'Q', 'H') |
colorlight | String | '#ffffff' | Dark color |
colordark | String | '#000000' | Light Color |
usesvg | Boolean | false | SVG Output |
Depending on the size of the qrdata to encode, a minimum size might be required.
MIT License