Tmpqrcode.jpeg does not get refreshed

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) { (() => {
    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 barcode value does not get updated.
  • The image does not gets refreshed.
  • The tmpqrcode.jpeg does not gets refreshed.

Either way I can’t get it work.

Thanks a lot.

<img [src]="imageUrl">

…and lose the zone stuff.

Nope, still get the very same image.

If this is the actual code, you’re ignoring the value of someText that’s passed into encodeSomeText(), as you’re setting it to 'image.url' in the very first line.

You are right, but I have it right on my code, I added that line when I was starting to ask the question and I forgot to erase it.

When I close the app and open it again it changes. I think one of my guesses are right, I just don’t know how to fix them.

You could give this library a shot.

I did, it does not work. I can’t even make it display the qr and, research made, a lot of people have the same problem as me. I’d like to know what is happening in here. I can’t understand what is happening.