0

cordova.file.tempDirectory我们想使用我们尝试过的文件插件读取图像名称表单

 $cordovaFile.readAsText(cordova.file.tempDirectory)
            .then(function (success) {
                 console.log("success2"+success);
                  }, function (error) {
                      console.log("error"+error);
                  });
But We got error


ERROR: Wrong type for parameter "path" of DirectoryEntry.getFile: Expected String, but got Undefined.
2016-08-25 09:23:28.958 DPOD[3482:38292] Error in Success callbackId: File1548160221 : TypeError: Wrong type for parameter "path" of DirectoryEntry.getFile: Expected String, but got Undefined.

cordova.file.tempDirectory 只有 10 个图像。所以我们需要 10 个图像名称。告诉我我们的代码有什么问题。请指导我们。

4

1 回答 1

0

$cordova.readAsText接受两个参数pathfile

// READ
$cordovaFile.readAsText(cordova.file.dataDirectory,$scope.inputs.readFile)
  .then(function (success) {
    // success
  }, function (error) {
    // error
  });

尝试将文件作为数组缓冲区读取。在此处查看其他用于读取文件的选项。ngCordova 文件插件

确保添加 ngCordova 文件和适当的依赖注入。安装指南

于 2016-08-26T16:45:02.643 回答