Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
ngx-angular-qrcode
Advanced tools
This library allow you to create beautiful QR Codes in Angular application.
This library provides an Angular component to create beautiful QR codes in your application.
Note that, this library supports Angular version 9 till version 15 onward, and verified with demos.
If you need to dynamic QR codes with analytics and more features, check out QRtrac
Create, and download beautiful QR Codes.
This is an Angular wrapper library over the plain JavaScript QR Code Styling library
Install the library by running npm install ngx-angular-qrcode
command in your Angular project directory.
Import NgxAngularQrcodeModule
module into AppModule
or any lazy loaded child module of your Angular application.
import { NgxAngularQrcodeModule } from 'ngx-angular-qrcode';
@NgModule({
declarations: [
AppComponent
],
imports: [
NgxAngularQrcodeModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
<qr-code></qr-code>
selector in your component's HTML file or template. The parameters can be configured per requirements. <qr-code #qrCode
[qrData]="qrData"
[shape]="shape"
[width]="width"
[height]="height"
[margin]="margin"
[imageUrl]="imageUrl"
[dotsType]="dotsType"
[dotsColor]="dotsColor"
[dotsGradient]="dotsGradient"
[dotsStartColor]="dotsStartColor"
[dotsEndColor]="dotsEndColor"
[dotsGradientType]="dotsGradientType"
[dotsGradientRotation]="dotsGradientRotation"
[cornerSquareType]="cornerSquareType"
[cornerSquareColor]="cornerSquareColor"
[cornerSquareGradient]="cornerSquareGradient"
[cornerSquareStartColor]="cornerSquareStartColor"
[cornerSquareEndColor]="cornerSquareEndColor"
[cornerSquareGradientType]="cornerSquareGradientType"
[cornerSquareGradientRotation]="cornerSquareGradientRotation"
[cornerDotType]="cornerDotType"
[cornerDotColor]="cornerDotColor"
[cornerDotGradient]="cornerDotGradient"
[cornerDotStartColor]="cornerDotStartColor"
[cornerDotEndColor]="cornerDotEndColor"
[cornerDotGradientType]="cornerDotGradientType"
[cornerDotGradientRotation]="cornerDotGradientRotation"
[backgroundColor]="backgroundColor"
[backgroundGradient]="backgroundGradient"
[backgroundStartColor]="backgroundStartColor"
[backgroundEndColor]="backgroundEndColor"
[backgroundGradientType]="backgroundGradientType"
[backgroundGradientRotation]="cornerDotGradientRotation"
[imageSize]="imageSize"
[imageMargin]="imageMargin"
[hideImageBackgroundDots]="hideImageBackgroundDots"
[errorCorrectionLevel]="errorCorrectionLevel"></qr-code>
#qrCode
or any variable name to call download
method to download qr code if its used in @ViewChild()
.import { Component, ViewChild } from '@angular/core';
import { NgxAngularQrcodeComponent } from 'ngx-angular-qrcode';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
qrData = 'https://qrtrac.com';
shape = 'circle';
width = 300;
height = 300;
margin = 5;
imageUrl!: string;
// Dots Options
dotsType = 'Rounded';
dotsGradient = true;
dotsColor!: string;
dotsStartColor = '#11ff33';
dotsEndColor = '#ff1122';
dotsGradientType = 'linear';
dotsGradientRotation = 0;
// Corner Square Options
cornerSquareType = 'Rounded';
cornerSquareGradient = true;
cornerSquareColor!: string;
cornerSquareStartColor = '#ff12ff';
cornerSquareEndColor = '#E09515';
cornerSquareGradientType = 'linear';
cornerSquareGradientRotation = 0;
// Corner Dot Options
cornerDotType = 'Rounded';
cornerDotGradient = true;
cornerDotColor!: string;
cornerDotStartColor = '#ffff00';
cornerDotEndColor = '#333333';
cornerDotGradientType = 'radial';
cornerDotGradientRotation = 0;
// Background Options
backgroundType = 'Rounded';
backgroundGradient = false;
backgroundColor = '#ffffff'
backgroundStartColor = '#ffffff';
backgroundEndColor = '#B7C2E1';
backgroundGradientType = 'radial';
backgroundGradientRotation = 0;
// Image Options
imageSize!: number;
imageMargin!: number;
hideImageBackgroundDots = true;
errorCorrectionLevel = 'Q';
fileExtension = 'png';
@ViewChild(NgxAngularQrcodeComponent, { static: true }) qrCode!: NgxAngularQrcodeComponent;
qrImageChanged(event: any): void {
const files = event.target.files;
const fileToUpload = files.item(0);
let reader = new FileReader();
reader.onload = (event: any) => {
this.imageUrl = event.target.result;
}
reader.readAsDataURL(fileToUpload as Blob);
}
downloadQr(): void {
this.qrCode.download(this.fileExtension);
}
}
Please refer to this API Documentation to understand each parameters, and different options for them.
FAQs
This library allow you to create beautiful QR Codes in Angular application.
The npm package ngx-angular-qrcode receives a total of 61 weekly downloads. As such, ngx-angular-qrcode popularity was classified as not popular.
We found that ngx-angular-qrcode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.