In this tutorial, we will create / produce a QR Code generator web application with Angular 10/11 so let's get started.

We learn How to make QR code at angular 11. QR code generator app is a simple application. we read the random QR code generator see below.

This tutorial will use the angularx-qrcode npm package to generate a QR code in an angular app 11. Also enter the QRCodeModule module code. see below step by step generator QR code angular 11.


Step 1 – Create New Angular App

First, of all let's start by creating an Angular 11 project using the Angular CLI.

Open your terminal or command prompt, and generate a new angular project by running the following command:

ng new my-new-app


Step 2 – Install angularx-qrcode npm Package

In this step, you need to install angularx-qrcode in our angular application. So, the following command:

npm install angularx-qrcode --save


Step 3 – Add Code on Module.ts File

In this step, go to the src/app directory and open app.module.ts file. Then add the following code into it:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { QRCodeModule } from 'angularx-qrcode';    //<------------ import this code ------------

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    QRCodeModule      //<------------ import this code ------------
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Step 4 – Add Code on View File

In this step, create HTML and display QR code in angular 11 application. So, app.component.html and update the following code into it:

<h1>Create/Generate QR Codes In Angular 10/11 -  phpcodingstuff.com</h1>
<qrcode [qrdata]="'myAngularxQrCode'" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>




Step 5 – Add Code On Component ts File

In this step, open app.component.ts. Then add the following code into the 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 () {
    // assign a value
    this.myAngularxQrCode = 'Your QR code data string';
  }
}


Step 6 – Start Angular App

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

ng serve

I hope it can help you...