All Projects → Cordobo → Angularx Qrcode

Cordobo / Angularx Qrcode

Licence: mit
Angular4/5/6/7/8/9/10/11 QRCode generator component library for QR Codes (Quick Response) with AOT support based on node-qrcode

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Angularx Qrcode

Aspnetcore Angular Universal
ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
Stars: ✭ 1,455 (+417.79%)
Mutual labels:  ssr, angular4, angular5, angular6
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-90.75%)
Mutual labels:  ionic, angular4, angular5, angular6
AuthGuard
Example repo for guarding routes post
Stars: ✭ 42 (-85.05%)
Mutual labels:  angular4, angular5, angular6
file-input-accessor
Angular directive that provides file input functionality in Angular forms.
Stars: ✭ 32 (-88.61%)
Mutual labels:  angular4, angular5, angular6
ngx-image-editor
Awesome image editor for Angular 6
Stars: ✭ 74 (-73.67%)
Mutual labels:  angular4, angular5, angular6
mean-stack
MEAN stack Mongoose, Express, Angular6, Node
Stars: ✭ 22 (-92.17%)
Mutual labels:  angular4, angular5, angular6
Ng2 Smart Table
Angular Smart Data Table component
Stars: ✭ 1,590 (+465.84%)
Mutual labels:  aot, aot-compilation, angular4
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-92.17%)
Mutual labels:  ionic, angular4, angular5
ng-toggle
Bootstrap-styled Angular Toggle Component
Stars: ✭ 14 (-95.02%)
Mutual labels:  angular4, angular5, angular6
ngx-img
No description or website provided.
Stars: ✭ 25 (-91.1%)
Mutual labels:  angular4, angular5, angular6
ngx-print
🖨️ A plug n' play Angular (2++) library to print your stuff
Stars: ✭ 124 (-55.87%)
Mutual labels:  angular4, angular5, angular6
Egeo
EGEO is the open-source UI library used to build Stratio's UI. It includes UI Components, Utilities, Services and much more to build user interfaces quickly and with ease. The library is distributed in AoT mode.
Stars: ✭ 69 (-75.44%)
Mutual labels:  aot, aot-compilation, angular4
Ngx Qrcode
An Angular 9/10 Component Library for Generating QR (Quick Response) Codes
Stars: ✭ 161 (-42.7%)
Mutual labels:  qrcode, angular4, angular6
Angular2 Toaster
Angular2-toaster is an asynchronous, non-blocking Angular Toaster Notification library
Stars: ✭ 333 (+18.51%)
Mutual labels:  aot-compilation, angular4, angular5
angular-rollbar-source-maps
Angular 2+ implementation to upload sourcemaps to Rollbar
Stars: ✭ 17 (-93.95%)
Mutual labels:  angular4, angular5, angular6
angularx-qrcode-sample-app
Angular5/6/7/8/9/10+ sample apps with working implementations of angularx-qrcode
Stars: ✭ 15 (-94.66%)
Mutual labels:  angular4, angular5, angular6
Ng2 Idle
Responding to idle users in Angular (not AngularJS) applications.
Stars: ✭ 240 (-14.59%)
Mutual labels:  angular4, angular5, angular6
Angular Contacts Demo
Angular demo(SSR) base on Angular CLI
Stars: ✭ 42 (-85.05%)
Mutual labels:  ssr, angular4, angular5
spring-websocket-angular6
Example for using Spring Websocket and Angular with Stomp Messaging
Stars: ✭ 18 (-93.59%)
Mutual labels:  angular4, angular5, angular6
ngx-konami
A simple directive to add easter eggs in your Angular application 👾
Stars: ✭ 34 (-87.9%)
Mutual labels:  angular4, angular5, angular6

angularx-qrcode

angularx-qrcode is a fast and easy-to-use Ionic 3/4/5 and Angular4-11 QR Code component/module library to generate QR Codes (Quick Response) in your Ionic and Angular 4/5/6/7/8/9/10/11 app with support for AOT and the Ivy compiler and runtime. It is a drop-in replacement for the no-longer-maintained angular2 component ng2-qrcode and based on node-qrcode.

Demo App

An Angular app with a working implementation of angularx-qrcode is available as a project in this repository. Run the command

ng serve demo-app

and open the url http://localhost:4200/ in your browser

For versions prior to 11, a working app is available at github.com/Cordobo/angularx-qrcode-sample-app.

Install angularx-qrcode 11.0.x with Angular 11

Angular 11 requires angularx-qrcode 11:

# Angular 11 and Ionic
npm install angularx-qrcode --save
# Or use yarn
yarn add angularx-qrcode

Install angularx-qrcode 10.0.x with Angular 10

Starting with angularx-qrcode 10, major versions of angular and angularx-qrcode are synchronized, so angular 10 requires angularx-qrcode 10, making it easier to use the right version.

# Angular 10 and Ionic
npm install [email protected] --save
# Or use yarn
yarn add [email protected]

Install angularx-qrcode 2.3.x with Angular 9

# Angular 9 and Ionic
npm install [email protected]~2.3.5 --save
# Or use yarn
yarn add [email protected]~2.3.5

Install angularx-qrcode 2.1.x with Angular 8

# Angular 8 and Ionic
npm install [email protected]~2.1.4 --save
# Or use yarn
yarn add [email protected]~2.1.4

Older Angular Versions

# Angular 5/6/7
npm install [email protected] --save
# Angular 4
npm install [email protected] --save

New in angularx-qrcode 2.x

  • Ivy Compiler and Runtime Support
  • angularx-qrcode is now based on node-qrcode and ships a couple of new features (keeping all the known features)
  • New: append CSS classes with cssClass
  • New elementType field: url, img, canvas and svg
  • New margin field. Define how wide the quiet zone should be.
  • New scale, scale factor. A value of 1 means 1px per module (black dot).
  • New version field. QR Code version. If not specified the most suitable value will be calculated.

Upgrade from 1.x to 2.x or 10.x

Upgrading should be simple. If any deprecated field is used, angularx-qrcode logs a warning to your browser console with the field name which should be renamed.

# Old code in 1.x
<qrcode [qrdata]="'Your data'" [size]="256" [level]="'M'" usesvg="true"></qrcode>

# New code in 2.x or 10.x
<qrcode [qrdata]="'Your data'" [width]="256" [errorCorrectionLevel]="'M'" [elementType]="'svg'"></qrcode>
Deprecated New
colordark colorDark
colorlight colorLight
level errorCorrectionLevel
size width
usesvg elementType

Basic Usage

Import the module and add it to your imports section in your main AppModule:

// File: app.module.ts
// all your imports
import { QRCodeModule } from 'angularx-qrcode';

@NgModule({
declarations: [
  AppComponent
],
imports: [
  QRCodeModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Examples: How to implement angularx-qrcode

Generate a QR Code from a string (directive only)

Now that Angular/Ionic knows about the new QR Code module, let's invoke it from our template with a directive. If we use a simple text-string, we need no additional code in our controller.

<qrcode [qrdata]="'Your data string'" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>

Create a QR Code from a variable in your controller

In addition to our <qrcode>-directive in example.html, lets add two lines of code to our controller example.ts.

// File: example.ts
export class QRCodeComponent {
  public myAngularxQrCode: string = null;
  constructor () {
    // assign a value
    this.myAngularxQrCode = 'Your QR code data string';
  }
}

// File: example.html
<qrcode [qrdata]="myAngularxQrCode" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>

Parameters

Attribute Type Default Description
allowEmptyString Boolean false Allow qrdata to be an empty string
colorDark String '#000000ff' RGBA color, color of dark module
colorLight String '#ffffffff' RGBA color, color of light module
cssClass String 'qrcode' CSS Class
elementType String 'canvas' 'canvas', 'svg', 'img', 'url' (alias for 'img')
errorCorrectionLevel String 'M' QR Correction level ('L', 'M', 'Q', 'H')
margin Number 4 Define how much wide the quiet zone should be.
qrdata String '' String to encode
scale Number 4 Scale factor. A value of 1 means 1px per modules (black dots).
version Number (auto) 1-40
width Number 10 Height/Width (any value)

Note

Depending on the amount of data of the qrdata to encode, a minimum width is required.

AOT - Ahead Of Time Compilation

angularx-qrcode supports AOT Compilation (Ahead-of-Time Compilation) which results in significant faster rendering. An AOT-enabled module is included. Further reading: https://angular.io/guide/aot-compiler

SSR - Server Side Rendering

As of version 1.6.0, SSR support is fully implemented, the following workaround is no longer needed. HowTo use Angular QRCode with SSR

Available commands

# Build
npm run build

Contribution

  • Please open your PR against the development branch.
  • Make sure your editor uses the packages .editorconfig file to minimize commited code changes.
  • Use npm run lint before you commit

License

MIT License

Copyright (c) 2018 - present Andreas Jacob (Cordobo.com)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].