Skip to content

Store data on mobile devices (using cordova) that persists even if the user reinstalls the app

Notifications You must be signed in to change notification settings

RiteshAryal/ng-persist

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-persist

Install

$ bower install ng-persist ngstorage --save

For ios, KeychainPlugin is required:

$ cordova plugin add https://github.com/shazron/KeychainPlugin.git

For Android, cordova-plugin-file is required:

$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git

Usage

Require ng-persist and ngstorage

angular.module('myApp', [
    'ngStorage',
    'ng-persist'
]);

Inject $persist into your controller

.controller('MyCtrl', function($persist) {

    // write
    $persist
        .set(namespace, key, val)
        .then(function () {
            // saved
        });

    // read
    $persist
        .get(namespace, key, fallback)
        .then(function (val) {
            // val is either the value, if exists, or the fallback
        });

    // delete
    $persist
        .remove(namespace, key)
        .then(function () {
            // removed
        });

});

License

MIT

About

Store data on mobile devices (using cordova) that persists even if the user reinstalls the app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%