Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<ngx-qrcode> isn't known element in ionic 4

Since working for a QR code scanning application in ionic 4, I continuously get the error called as below:

Error: Template parse errors: Can't bind to 'qrc-value' since it isn't a known property of 'ngx-qrcode'. 1. If 'ngx-qrcode' is an Angular component and it has 'qrc-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. ("

<ion-card *ngIf="createdCode">
<ngx-qrcode [ERROR ->][qrc-value]="createdCode"></ngx-qrcode>
<ion-card-content>

Please help me solve this.

like image 576
Yash Avatar asked Dec 18 '22 18:12

Yash


2 Answers

Besides import the module in app.module.ts (following the instructions on https://www.npmjs.com/package/ngx-qrcode2) make sure to do the same in the page-name.module.ts too.

I've had the same trouble and this solution solved it. :)

like image 138
Ace Cooper Avatar answered Dec 20 '22 16:12

Ace Cooper


If you are using lazy-loading, import NgxQRCodeModule on the module where is your page, not on app.module.

also try this --

use [(qrc-value)] instead of [qrc-value]
<ngx-qrcode [(qrc-value)]="createdCode"></ngx-qrcode>
like image 27
Kshitij Avatar answered Dec 20 '22 17:12

Kshitij