Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

593
Views
Error while downloading features on qr-code generated using angularx-qrcode?

I used angularx-qrcode to generate a qrcode where it populates data from qrInfo. However I am getting this error:

ERROR TypeError: Cannot read properties of undefined (reading 'qrcElement') The code on qr-code-generate.component.html looks like:

<qrcode *ngIf="qrInfo" cssClass="coolQRCode" #qrcode [qrdata]="qrInfo" [width]="256" elementType="img" [errorCorrectionLevel]="'M'"></qrcode><a [href]="link" download><button class="btn btn-block (click)="downloadQRCode()">Download QRCode</button></a>

Whereas the code on the controller qr-code-generate.component.ts looks:

link: string;
 @ViewChild('qrcode', { static: true }) qrcode: QRCodeComponent;

  qrInfo : any;

Back to the *.component.ts file we handle the downloadQRCode() function as follows:

downloadQRCode() {this.link = this.qrcode.qrcElement.nativeElement.firstChild.src}

I can not download the img using the reference to the qrcode element we can access it's firstChild. And when I remove *ngIf="qrInfo" from ***.component.html I am receiving an error

angularx-qrcode.mjs:165 [angularx-qrcode] Error generating QR Code: angularx-qrcode] Field `qrdata` is empty, set allowEmptyString="true"' to overwrite this behaviour.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

guzmanoj already helped out with the original issue, just as a future reference for other users, the lib angularx-qrcode has an issue where we track solutions how to download a qrcode

I think I should implement the download feature in the demo app

HTH

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!