Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

595
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda