Ngcordova File does not generate file

Asked

Viewed 58 times

1

I’m using $cordovaFile(ngCordova) + Ionic for my application and I need to store a json in a local file but I’m not able to generate the file to popular with json.

controller js.

app.controller('Controllereletrica', 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');
      });
});

});
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.