An Angular service providing two way binding to localStorage
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.md
README.md
store.js

README.md

Store

This project is no longer maintained and part of my source code "attic". Please use a more mature and tested alternative. Feel free to use this though, works fine.

An Angular service providing two way binding to localStorage

Examples

To create a two-way binding between localStorage and a controller's $scope, all you have to do is call Store#mirror.

/**
 * Controls the plugin modal for installing and exploring plugins.
 */
app.controller("MyController", ["$scope", "Store", function($scope, Store) {

    $scope.model = Store.mirror($scope, "model", "model", {});

}]);

Once that's done, any changes to $scope.model will propagate to localStorage.model and also the other way around. And because localStorage events are cross-window this will also create a cross-window binding.