Skip to content

An angular module for accessing the localStorage as standard object.

Notifications You must be signed in to change notification settings

eladdo92/ImmediateStorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImmediateStorage

An angular module for accessing the localStorage as standard object.

You can create, change and delete properties on this object, and the changes will be saved in the local storage immediately. Next time your app will run, the object will be filled with all the properties from the last run.

Using Object.observe()!

How to use?

Controller:

angular.module('myApp', ['ImmediateStorage'])
    .controller('myController', function(ImmediateStorageService, $scope) {
        var myStorage = new ImmediateStorageService('myStorage');

        myStorage.someKey = 'some value';               // saved to localStorage!
        myStorage.someOtherKey = 'some other value';    // saved to localStorage!
        myStorage.someKey = 'some value2';              // changed in localStorage!
        delete myStorage.someKey;                       // deleted from localStorage!

        $scope.storage = myStorage;
   });

View:

<div ng-app="myApp" ng-controller="myController">
  <pre>{{ storage | json }}</pre>
</div>

Next time we ask for:

new ImmediateStorageService('myStorage');

it will be full!

How to install?

$ bower install https://github.com/eladdo92/ImmediateStorage.git

About

An angular module for accessing the localStorage as standard object.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published