Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

FileSystem problem - cordova Ionic Application

$
0
0

Hello everyone,

I have a problem with requestFileSystem function. I have the following error in firefox:

Error: requestFileSystem is not defined
$scope.save@http://localhost:8100/js/controllers/AddCtrl.js:14:9
$scope.addAss@http://localhost:8100/js/controllers/AddCtrl.js:9:9
anonymous/fn@http://localhost:8100/lib/ionic/js/ionic.bundle.js line 26457 > Function:2:206
ngEventHandler/</callback@http://localhost:8100/lib/ionic/js/ionic.bundle.js:36610:17
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:8100/lib/ionic/js/ionic.bundle.js:29158:16
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8100/lib/ionic/js/ionic.bundle.js:29257:18
ngEventHandler/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:36615:17
createEventHandler/eventHandler@http://localhost:8100/lib/ionic/js/ionic.bundle.js:16583:9
triggerMouseEvent@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2948:3
tapClick@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2937:3
tapMouseUp@http://localhost:8100/lib/ionic/js/ionic.bundle.js:3013:5
EventListener.handleEvent*tapEventListener@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2921:5
ionic.tap.register@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2734:5
FrameRequestCallback*ionic.DomUtil.requestAnimationFrame@http://localhost:8100/lib/ionic/js/ionic.bundle.js:185:14
domReady@http://localhost:8100/lib/ionic/js/ionic.bundle.js:141:7
EventListener.handleEvent*@http://localhost:8100/lib/ionic/js/ionic.bundle.js:147:5
@http://localhost:8100/lib/ionic/js/ionic.bundle.js:133:1
@http://localhost:8100/lib/ionic/js/ionic.bundle.js:22:2

:
thanks for your help
problem after alert "OK 1"
Here is my code

app.controller('AddCtrl', function ($scope, $location) {

    $scope.moment = {
        image: 'images/place.PNG',
        nom: ''
    };

    $scope.moments = [];

    $scope.addAss = function () {
        $scope.moments.push($scope.moment);
        $scope.save();
    };

    $scope.save = function () {
        alert ('Ok 1');
        requestFileSystem(window.PERSISTENT, 0, fsReceived, errorHandler);
        $location.path('/');

    };

    var fsReceived = function (fileSystem) {
        alert ('Ok 2');
        fileSystem.root.getFile('moments.json', { create: true, exclusive: false }, feReceived, errorHandler);
    };

    var feReceived = function (fileEntry) {
        fileEntry.createWriter(fwReceived, errorHandler);
    };

    var fwReceived = function (fileWriter) {
        var momentsText = angular.toJson($scope.moments);
        fileWriter.write(momentsText);
    };

    var errorHandler = function (error) {

    };

})

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>