+
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

TLmaK0/ng-persist

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-persist

Install

$ bower install ng-persist ngstorage --save

For ios, KeychainPlugin is required:

$ cordova plugin add https://github.com/driftyco/cordova-plugin-ios-keychain.git

For Android, cordova-plugin-file is required:

$ cordova plugin add cordova-plugin-file

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%
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载