这是我的代码:
pickimages() {
this.imgPicker.getPictures({
outputType: 0
}).then((results) => {
this.slideOneForm.value.image_file_arr = results
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
this.images.push(this.getTrustImg(results[i]))
}
}, (err) => { console.log("errrrrrrrrrrrr") });
}
private win: any = window;
getTrustImg(imageSrc) {
let path = this.win.Ionic.WebView.convertFileSrc(imageSrc);
return (path)
}
save() {
this.submitAttempt = true;
let postObj = this.slideOneForm.value
postObj.api_token = this.token
this.slideOneForm.value.image_file_arr = this.images
console.log(this.slideOneForm.value)
this.propertyManager.addNewProperty(postObj)
.then(res => {
}, err => {
})
}
提供者功能:
addNewProperty(postData) {
return new Promise((resolve, reject) => {
this.http.post(this.url + "properties", postData)
.subscribe(data => {
resolve(data);
}, err => {
reject(err);
});
});
}
非常感谢。