Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- customers = [];
- $scope.accounts = {customers};
- $scope.addAccount = function () {
- $scope.accounts.customers.push($scope.account);
- $scope.save();
- };
- $scope.save = function () {
- document.addEventListener("deviceready", function() {
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fsReceived, errorHandler);
- }, false);
- };
- function fsReceived() {
- var data = angular.toJson($scope.accounts);
- $cordovaFile.writeExistingFile(cordova.file.externalRootDirectory, "accounts.json", data).then(function (success) {
- alert('Success');
- }, errorHandler);
- };
- {"customers" = [{a:"a", b:"b"}, {c:"c", d:"d"}]}
- {"customers" = [{a:"a", b:"b"]}, "customers" = [{c:"c", d:"d"}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement