0
我得到這個錯誤
$ cordovaFileTransfer.download是不是一個函數
我的代碼是這樣的
app.controller('GalleryCtrl', ['$scope', '$cordovaFileTransfer', function($scope, $cordovaFileTransfer) {
$scope.testFileDownload = function() {
var url = "http://www.gajotres.net/wp-content/uploads/2015/04/logo_radni.png";
var filename = url.split("/").pop();
var targetPath = cordova.file.externalRootDirectory + filename;
alert(targetPath);
$cordovaFileTransfer.download(url, targetPath, {}, true).then(function (result) {
alert('Success!');
}, function (error) {
alert('Error!');
}, function (progress) {
// PROGRESS HANDLING GOES HERE
});
};
}])
在我的應用程序的js我已經定義ngCordova
您是否使用CLI安裝它? cordova插件添加cordova-plugin-file-transfer – tier1