что означает __zone_symbol__currentTask
? Im работает с Ionic2 и поймал этот объект, увидев прикрепленное изображение. Я пытаюсь использовать несколько обещаний, эти ошибки связаны с обещаниями?
Я также отправил сообщение на https://github.com/angular/zone.js/issues/796
useCamera(){
const getURI = () => {
const opts: CameraOptions = {
quality: 100,
mediaType: this.camera.MediaType.PICTURE,
encodingType: this.camera.EncodingType.JPEG,
destinationType: this.camera.DestinationType.FILE_URI,
targetWidth: 200,
targetHeight: 200,
correctOrientation: true,
saveToPhotoAlbum: false
};
let promise = new Promise( (resolve, reject) => {
this.camera.getPicture(opts)
.then( (uri) => {
resolve(uri);
})
.catch( (err) => { reject(err) });
});
return promise;
}
// # 2
const moveFile = (uri) => {
const _extension = '.' + this.getFileExtension(uri);
const _name = this.getFileName(uri) + _extension;
const _newPath = this.myStoragePath;
const _newName = 'camera_' + this.hashName() + _extension;
const _uri = uri.substring(0, uri.lastIndexOf('/') + 1);
let promise = new Promise( (resolve, reject) => {
this.file.moveFile(_uri, _name, _newPath, _newName)
.then( (res) => {
resolve(res.nativeURL);
})
.catch( (err) => {
alert('COPY_FILE_CAMERA_ERR ' + JSON.stringify(err));
reject(err);
});
});
return promise;
}
// # 3
return getURI().then(moveFile)
}
//////////////////////
// THE CALLER OUTSIDE
//////////////////////
this.cameraSettings
.useCamera() // <------------------ entry point
.then( (res) => {
alert('USER.TS_OPEN_CAMERA_SUCC ' + JSON.stringify(res))
})
.catch( (err) => {
alert('USER.TS_OPEN_CAMERA_ERR ' + JSON.stringify(err))
});
moveTo, copyFile должен вызывать entryFile, а не this.file ссылаться на эту статью ionic 1 https://devdactic.com/how-to-capture-and-store-images-with-ionic/ ionic 2 https://github.com/AUSdomgarcia/падла-ionic2/блоб/ведущий /SRC/Shared/камера-settings.service.ts
перейти к использованию useMedia()