Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

The change of data in controller doesn't update automatically

$
0
0

Sorry, the code is not complete. Here is my code with the class definition.

My class:

import {IonicApp, Page,NavController, NavParams} from 'ionic/ionic';

@Page({
  selector: 'pipes',
  changeDetection: 'ON_PUSH',
  templateUrl: 'build/pages/post/new-post.html'
})

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

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

My html:

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

My issue is the thumbnail I got from imagePick function is not updated in my page. (It will only be shown after I scroll my page).

This code after I add 'async' does not work because :

EXCEPTION: Invalid argument 'img/placeholder.png' for pipe 'AsyncPipe' in [thumbnail | async in NewPostPage@25:13]

I have no idea how to attach my thumbnail to async pipe.

Any idea? Thanks


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>