0.1.1 • Published 8 years ago

ng2-qrcode v0.1.1

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

dependencies

ng2-qrcode

ng2-qrcode is a simple Angular2 Component for generating QRCode It uses QRCode.js. QRCode.js supports Cross-browser with HTML5 Canvas and table tag in DOM.

Install

npm install ng2-qrcode

Basic Usage

Include the component and declare it as Directive

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>
  `
})

Include the qrcode.js library in your site

  <script src="<node_modules_path>/qrcodejs2/qrcode.min.js"></script>

Parameters

AttributeTypeDefaultDescription
qrdataString''String to encode
sizeNumber256Height / Width
levelString'M'QR Correction level ('L', 'M', 'Q', 'H')
colorlightString'#ffffff'Dark color
colordarkString'#000000'Light Color
usesvgBooleanfalseSVG Output

Note

Depending on the size of the qrdata to encode, a minimum size might be required.

License

MIT License