Javascript 如何删除离子2中的映像文件系统?

Javascript 如何删除离子2中的映像文件系统?,javascript,arrays,file,ionic-framework,ionic2,Javascript,Arrays,File,Ionic Framework,Ionic2,我正在尝试从库中删除图像 将显示一个错误: resolveLocalFileSystemURI的参数“uri”的类型错误:应为 字符串,但得到数组 代码 let data:Array<{ imgUrl: string, fileName: string }>; data = new Array(); let j = 0; for(let test of pathimg){ data.push({imgUrl:pathimg,fileName:fil

我正在尝试从库中删除图像

将显示一个错误:

resolveLocalFileSystemURI的参数“uri”的类型错误:应为 字符串,但得到数组

代码

let data:Array<{ imgUrl: string, fileName: string }>;
    data = new Array();
    let j = 0;
    for(let test of pathimg){
      data.push({imgUrl:pathimg,fileName:filename[j]+'.png'});
      j++;
    }

for(let test of data){    
    this.file.removeFile(test.imgUrl, test.fileName).then(_ =>
        console.log('deleted succesfully')).catch(err =>
            console.log('cannot delete'));
}
let数据:数组;
数据=新数组();
设j=0;
for(让我们测试路径){
push({imgUrl:pathimg,fileName:fileName[j]+'.png'});
j++;
}
对于(数据的let测试){
this.file.removeFile(test.imgUrl,test.fileName)
console.log('deleted successfully')).catch(err=>
console.log('无法删除');
}

您提供的信息非常有限,但我猜test.imgUrl是一个数组,您需要在其中添加URI的字符串…@VeldMuijz update code check i m convert string但不工作show me成功地[{“imgUrl”:["file:///data/user/0/com.pmtx.schooltune/files/cj3iNgR11Pth3LspEu3wSM/18fb5a7ee591a3a1195d1a119fd1a6be.png“],“fileName”:“18fb5a7ee591a3a1195d1a119fd1a6be.png”}]ImgUrl是一个数组,值是一个数组。您可以看到这一点,因为它被
[
]