Reputation: 330
I've been stuck on this problem for almost 3 days now. So what I'm currently trying to do, is display a QR Code on a page that takes you to a URL. For this, I'm using ngx-qrcode2
.
So far, I've already tried running an npm install ngx-qrcode2 --save
. Then, I followed this tutorial: https://www.youtube.com/watch?v=4bsrqHcb-hQ, even generating another angular app, and following exactly what he did. It still doesn't work. After running it, my console displayed the following error:
Uncaught Error: Template parse errors:
Can't bind to 'qrc-value' since it isn't a known property of 'ngx-qr-code'.
Also, on my own app that I have been working on to generate a QR Code, it doesn't display a QR Code, but the difference is that it doesn't display any console errors either. This is separate from the QR Code app I tried generating.
Here's some of my code from the QR Code generated app:
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'qra-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
value = 'http://www.google.com';
}
app.component.html
<h1>Visit this site.</h1>
<ngx-qr-code qrc-element-type="url" [qrc-value]="value"></ngx-qr-code>
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgxQRCodeModule } from 'ngx-qrcode2';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgxQRCodeModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
My other app also has the exact same thing.
Also, if it helps, here's my package.json
file.
{
"name": "qrcode",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"core-js": "^2.5.4",
"ngx-qrcode2": "0.0.9",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~7.3.8",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}
At this point, I'm not sure what else to do. Thanks in advance.
Upvotes: 2
Views: 5024
Reputation: 3
I had got the same error.
As Manab said, it is deprecated. So use [value] instead of [qrc-value]:
<ngx-qrcode [value]="createdCode"></ngx-qrcode>
Upvotes: 0
Reputation: 111
The npm package ngx-qrcode2 has been deprecated. Use @techiediaries/ngx-qrcode instead.
Try installing
npm install @techiediaries/ngx-qrcode --save
Here's link for updated package https://www.npmjs.com/package/@techiediaries/ngx-qrcode
Upvotes: 3