angular - Media Capture Native Plugin Ionic 3 -


i making ionic 3 application in want enable user capture pictures , videos. used media capture plugin, once capture image or video mediafile[] promise in return. when trying display image preview in ion-img tag [src] = mediafile[‘0’].fullpath. not displaying image.

please tell me if appraoch wrong should do.

here capturing part:

this.mediacapture.captureimage()   .then(      (data: mediafile[]) => {          this.navctrl.push('newpostpage', {          mediafile : data          })     },     (err: captureerror) => console.error(err)   ); 

here html of newpostpage:

<ion-content padding>    <ion-img [src] = 'image'></ion-img>  </ion-content> 

here .ts file of newpostpage:

import { component } '@angular/core'; import { ionicpage, navcontroller, navparams } 'ionic-angular'; import { mediafile } '@ionic-native/media-capture';  /**  * generated class newpostpage page.  *  * see http://ionicframework.com/docs/components/#navigation more info  * on ionic pages , navigation.  */ @ionicpage() @component({   selector: 'page-new-post',   templateurl: 'new-post.html', }) export class newpostpage {    constructor(public navctrl: navcontroller, public navparams: navparams) {   }    mediafile: mediafile[] = this.navparams.get('mediafile');   image: string = this.mediafile['0'].fullpath;     ionviewdidload() {     console.log('ionviewdidload newpostpage');     console.log(this.image);       }  } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -