2
votes

I am trying to generate a Qr code and show It in the ionic component. I tried the following library https://www.npmjs.com/package/ngx-qrcode2

But It seems to not recognize the element correctly. I have tried:

<ngx-qrcode 
      [qrc-value] = "value"
</ngx-qrcode>

error

And Also:

  <ngx-qrcode 
  [elementType]="elementType" 
  [value] = "value"
  cssClass = "aclass"
  errorCorrectionLevel = "L">

with the following error at run time:

ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'value' since it isn't a known property of 'ngx-qrcode'.

  1. If 'ngx-qrcode' is an Angular component and it has 'value' input, then verify that it is part of this module.
  2. If 'ngx-qrcode' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" <ngx-qrcode [ERROR ->][value]="value">

I know This library is now deprecated, so I tried https://www.npmjs.com/package/@techiediaries/ngx-qrcode

Similar results:

enter image description here

enter image description here

Library was imported in component module as following:

import { UbicacionPageRoutingModule } from './ubicacion-routing.module';

import { UbicacionPage } from './ubicacion.page';
import { UbicacionAltaComponent } from './ubicacion-alta/ubicacion-alta.component';
import { NgxQRCodeModule } from '@techiediaries/ngx-qrcode';
import { VerQrUbicacionModalComponent } from './ver-qr-ubicacion-modal/ver-qr-ubicacion-modal.component';

@NgModule({
  entryComponents: [UbicacionAltaComponent, VerQrUbicacionModalComponent],
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    UbicacionPageRoutingModule,
    NgxQRCodeModule
  ],
  declarations: [UbicacionPage, VerQrUbicacionModalComponent],
  exports: [ UbicacionAltaComponent, VerQrUbicacionModalComponent]
})
export class UbicacionPageModule {}
2

2 Answers

1
votes
  1. Use ngx-qrcode Instead of ngx-qrcode2 (It is deprecated)
  2. Make sure you're imported in App Module and your Component Module
0
votes

"ngx-qrcode2" is deprecated, use ngx-qrcode instead. https://www.npmjs.com/package/@techiediaries/ngx-qrcode if you need a guide otherwise use https://github.com/techiediaries/ngx-qrcode if you prefer the git version