post-ad

Create OR Generate QR Code in Angular15 !!!

Generate QR code in angular 15 version :

step 1 : Create New App

command  :  ng new myNewApp
==> add Angular material 

command : ng add @angular/material

Step 2 – Install angularx-qrcode npm Package :

command :  npm install angularx-qrcode --save

Step 3 – Add Modules in Module.ts File

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
   
import { AppComponent } from './app.component';
import { QRCodeModule } from 'angularx-qrcode';
   
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    QRCodeModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Step 4 – Create QR Code On Html View File

<h1>How to Generate QR Code in Angular 15?</h1>

<div>
    <qrcode [qrdata]="'myAngularxQrCode'" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>
</div>

Step 5 – Add Code On Component ts File

import { Component } from '@angular/core';
   
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  public myAngularxQrCode: string = null;
   
  constructor () {
    this.myAngularxQrCode = 'tutsmake.com';
  }
}

Step 6 – Start Angular App

In this step, execute the following commands on terminal to start angular app:

command : npm start

Preview :

//================================= END ===================================//

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories

page-ad