public takePicture() {
let options: CaptureImageOptions = { limit: 3 };
return this.mediaCapture.captureImage(options)
.then((data: MediaFile[]) => {
console.log(data);
for (let i = 0; i <= data.length; i++) {
return this.beforeSave(data[i].fullPath).then((save) => {
this.save(save);
});
}
})
.catch((err: CaptureError) => { console.log(err) });
}
I am trying for each image that I am taking from my camera to phone to call the beforeSave(). However, only for the first one, the promise is returned. How should I implement my code in order to do it for each item in my data array?
Promise.allcan help you? developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…returnkeyword like I have in the answer.