Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

The change of data in controller doesn't update automatically

$
0
0

@zhouhaowowtv wrote:

I pick an image from album and assign it to a variable in class. But it won't be updated in my page until I scroll my screen up/down a bit.

For example, my html:

<img [src]='thumbnail' alt="">

My class:

export class NewPostPage {
  constructor(app: IonicApp, nav: NavController, params: NavParams) {
    this.nav = nav;
    this.thumbnail = 'img/placeholder.png';
  }

  imagePick() {
    var self = this;
    return new Promise(function(resolve,reject) {
      window.imagePicker.getPictures(function(results) {
        for (var i = 0; i < results.length; i++ ) {
          self.thumbnail = results[i];
          return resolve(result[i]);
        }
      }, function(error) {
        return reject(error);
      });
    }
  }

In ionic 1, we probably can call $scopy.$apply. What should I do in ionic 2? Any idea? Thanks.

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles