I'm using the $ cordovaFile (ngCordova) + ionic for my application and need to store a json in a local file plus I'm not able to generate the file to populate with json.
controller.js
app.controller ('Electric Controller', function ($ scope, $ stateParams, jsonBanco, $ cordovaFile) {
jsonBanco.getjson().then(function (data) {
$scope.dados = data.dados;
console.log($scope.dados);
});
document.addEventListener('deviceready', function () {
$cordovaFile.createFile(cordova.file.dataDirectory, "new_file.txt", true)
.then(function (success) {
console.log('FOI');
}, function (error) {
console.log('NAO FOI');
});
});
});