ngScopeStorage

An AngularJS module that binds $scope to the browser storage.
Homepage:
1 person uses it
Author: 11806915?v=3 rannn505

ngScopeStorage

An AngularJS module that binds $scope to the browser storage

Version npmNPM DownloadsDependencies

Installation

  • NPM: bash $ npm install ngscopestorage
  • CDN: html <script src="https://cdn.jsdelivr.net/angular.ngscopestorage/latest/ngscopestorage.min.js"></script>
  • Download/Clone this repo and include ngscopestorage.min.js in your project html <script src="Path/To/ngscopestorage.min.js"></script>

What's ngScopeStorage?

ngScopeStorage produce a 3 way data-binding by extending $scope's bindings ability. In other words this module allow $scope to bind his properties to local/session storage.
View <-- $scope --> BrowserStorage (local/session storage)

Setting up

  • Install ngScopeStorage
  • Include it in your app angular.module('app', ['ngScopeStorage'])
  • Inject $vms provider to your controller controller('ctrl', ['$scope','$vms', function($scope,$vms){})
  • Use $vms.config to feed the module with some necessary configurations NOTE: you must call this function in order the module to work properly. $vms.config function takes an JSON object with the following properties as an argument:
    • scope - The $scope of the controller from which you use the module (Object) required
    • ctrlName - The name of the controller from which you use the module (String) (Default:"http://localhost") required
    • prefix - A Unique name that will be saved alongside with your variables in the storage (String) (Default:"vms") optional
    • storageType - The storage in which your variables will be saved (localStorage/sessionStorage) (String) (Default:"localStorage") optional
  • Attach any properties that you want to $vms
  • Enjoy :)

License

MIT

comments powered by Disqus
This page was last updated over 1 year ago.