I’m encoding a text in a QR code. This is the code I have:
ionViewDidEnter () {
this.someText = this.navParams.get('text');
this.encodeSomeText (this.someText);
}
encodeSomeText (someText) {
this._zone.run (() => {
let barcode = BarcodeScanner;
barcode.encode (barcode.Encode.TEXT_TYPE, someText)
.then ((success) => {
this.imageUrl = success.file
console.log (success.file);
// Here I get a path, which I can't find:
// /private/var/mobile/Containers/Data/Application/CE83F727-F920-4C0F-8D41-EFA20A86C39F/tmp/tmpqrcode.jpeg
}), (error) => {
alert ('err: ' + error);
}
});
}
Then, I print it on my .html code like this:
<img src="{{imageUrl}}">
The problem here is that, when I try to recall a function with another value of someText, the tmpqrcode.jpeg does not update on my view and I get the first QR code I got, but it never changes again.
I guess some things:
- The
let barcodevalue does not get updated. - The image does not gets refreshed.
- The
tmpqrcode.jpegdoes not gets refreshed.
Either way I can’t get it work.
Thanks a lot.