I was trying to mod this here … from mike360 to cope with ionic
here is my factory
.factory('FileService', function($q, $rootScope, $window, $http, $ionicPlatform) {
return {
requestFileSystem: function(onSuccess, onError) {
console.log("FileService Factory");
$ionicPlatform.ready(function(onSuccess, onError) {
$window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function() {
var that = this,
args = arguments;
console.log("requestFileSystem onSuccess");
if (onSuccess) {
$rootScope.$apply(function() {
onSuccess.apply(that, args);
});
}
},
function() {
var that = this,
args = arguments;
console.log("requestFileSystem onError");
if (onError) {
$rootScope.$apply(function() {
onError.apply(that, args);
});
}
}
);
})
}
};
});
and controller
FileService.requestFileSystem(
function(fs) {
console.log(fs.root.name);
},
function() {
console.log('fail');
}
);
but is fails … to run the console.log in the controller portion?
any better way?
anyone got a nice file factory already?
related post from brian ford here for ref