Hello everybody,i have a problem with the transfer of data. So I have a QR scanner that is supposed to scan business cards (which it does). Then when the business cards are scanned, it should output them to me as a kind of item (see picture 1). The QR code for the business cards are output as JSON (see picture 2). Somehow I can’t get him to output them to me as an item, I’ve tried everything possible, but somehow I don’t get it.
Picture 1:
Picture 2:
how i tried to get what i want (it looks a bit stupid, but if you don’t have any ideas after a while, you test everything :D. In the beginning I knew what I was doing, but after a while I somehow tried, delete and reassemble all kinds of things.):
saveQR() {
this.visitenkarteService.addQR(this.scanResult).then(qrcode => {
this.qrcode = this.scanResult;
console.log('saveQR ' + this.qrcode.toString);
this.qrcodeTitel = this.scanResult.toString.title;
console.log('qrcodeTOstring ' + this.qrcode.toString);
console.log('qrcodeTOstringTITLE ' + this.qrcodeTitel);
// console.log('StrinGtest: ' + JSON.stringify(this.scanResult));
// this.qrcodeName = this.scanResult.name;
// this.qrcodeTelefon = this.scanResult.telefon;
// this.showToast('QR-Code Hinzugefügt!');
// this.timecreate = Date.now();
this.loadQR();
console.log(this.timecreate);
// const dateFormat = Date.now()[0];
// console.log(dateFormat);
}); }
here i tried to show me with a button:
loadQR() {
this.visitenkarteService.getQR().then(qrcode => {
this.qrcode = this.scanResult;
let result: any;
result = {
title: qrcode.title,
name: qrcode.name,
telefon: qrcode.telefon
};
// this.qrcode = JSON.stringify(result);
console.log('biggi' + JSON.stringify(result));
// this.qrcodeTitel = JSON.stringify(this.scanResult.title);
// console.log('HIER IST der titel: ' + JSON.stringify(this.scanResult.title));
// console.log('HIER IST TITEL222: ' + this.qrcodeTitel);
// this.qrcodeTelefon = JSON.stringify(this.scanResult.telefon);
}); }
my html:
<ion-list >
<ion-button expand="full" (click)="loadQR()" color="primary">
<ion-icon slot="start" name="easel-outline"></ion-icon>
Update contactlist
</ion-button>
<ion-list-header>
<ion-label>My Contact</ion-label>
</ion-list-header>
<!-- <ion-item-sliding *ngFor="let item of items"> -->
<ion-item *ngFor="let item of qrcode" color="light">
<ion-label text-wrap>
<h3>Titel: {{ item.title }}</h3>
<p>Name: {{ item.name }}</p>
<ion-text color="secondary">
<p>Telefon: {{ item.telfon }}</p>
</ion-text>
</ion-label>
</ion-item>
<!-- <ion-item-options side="end">
<ion-item-option color="danger" (click)="deleteItem(item)">Delete</ion-item-option>
</ion-item-options> -->
</ion-list>
I would be happy about any hints, tips or whatever. Thanks for your effort, even if you only had a look