【发布时间】:2016-01-31 00:19:24
【问题描述】:
我正在尝试加载这样存储的本地 json 文件:
www/json/config.json
var path = '/android_asset/www/json'; //<-i have tried lots of differnt path's without success
var fileName = "config.json";
console.log('url: '+path+fileName);
console.log('file there?: '+angular.toJson($cordovaFile.checkFile(path, fileName)) );
$cordovaFile.readAsText(path, fileName).then(function (success) {
console.log('read success: '+angular.toJson(success));
}, function (error) {
console.log('read error: '+angular.toJson(error));
});
我将 ionic 与 ngCordova 插件 $cordovaFile 一起使用...有人有建议吗? 我只想用加载的“默认”json 来发送我的应用程序......
【问题讨论】:
标签: android json path ionic ngcordova