{"id":15184499,"url":"https://github.com/auth0/angular-storage","last_synced_at":"2025-10-01T23:30:34.687Z","repository":{"id":21406961,"uuid":"24724938","full_name":"auth0/angular-storage","owner":"auth0","description":"A storage library for AngularJS done right","archived":true,"fork":false,"pushed_at":"2022-09-15T07:45:06.000Z","size":93,"stargazers_count":642,"open_issues_count":0,"forks_count":89,"subscribers_count":126,"default_branch":"master","last_synced_at":"2024-10-25T22:53:27.715Z","etag":null,"topics":["angularjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2014-10-02T15:35:51.000Z","updated_at":"2024-08-27T13:28:18.000Z","dependencies_parsed_at":"2022-08-21T10:11:00.088Z","dependency_job_id":null,"html_url":"https://github.com/auth0/angular-storage","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fangular-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fangular-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fangular-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fangular-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/angular-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234909086,"owners_count":18905504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angularjs"],"created_at":"2024-09-27T17:02:32.810Z","updated_at":"2025-10-01T23:30:34.323Z","avatar_url":"https://github.com/auth0.png","language":"JavaScript","readme":"\u003e **Warning**\n\u003e This repository has been archived, the libaray has been deprecated, but remains available on NPM.\n\n# angular-storage [![Build Status](https://secure.travis-ci.org/auth0/angular-storage.svg?branch=master)](https://travis-ci.org/auth0/angular-storage)\n\nA Storage done right for AngularJS.\n\n## Sponsor\n\n|||\n|-|-|\n|![auth0 logo](https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png)|If you want to quickly add secure token-based authentication to your Angular projects, feel free to check Auth0's Angular SDK and free plan at [auth0.com/developers](https://auth0.com/developers?utm_source=GHsponsor\u0026utm_medium=GHsponsor\u0026utm_campaign=angular-storage\u0026utm_content=auth)|\n\n## Key Features\n\n* Uses **`localStorage` or `sessionStorage` by default but if it's not available, it uses `ngCookies`**.\n* Lets you **save JS Objects**\n* If **you save a `Number`, you get a `Number`**, not a String\n* Uses a **caching system** so that if you already have a value, it won't get it from the store again.\n\n## Installing it\n\nYou have several options: Install with either bower or npm and link to the installed file from html using script tag.\n\n````bash\nbower install a0-angular-storage\n````\n\n````bash\nnpm install angular-storage\n````\n\n## Using it\n\n````js\nangular.module('app', ['angular-storage'])\n.controller('Controller', function(store) {\n  var myObj = {\n    name: 'mgonto'\n  };\n\n  store.set('obj', myObj);\n\n  var myNewObject = store.get('obj');\n\n  angular.equals(myNewObject, myObj); // return true\n\n  store.remove('obj');\n\n  store.set('number', 2);\n\n  typeof(store.get('number')) === 'number'\n});\n````\n\n## Namespaced Storages\n\nYou can also create namespaced storages if you want\n\n````js\nangular.module('app', ['angular-storage'])\n.factory('Auth0Store', function(store) {\n  return store.getNamespacedStore('auth0');\n})\n.controller('Controller', function(Auth0Store) {\n\n  var myObj = {\n    name: 'mgonto'\n  };\n\n  // This will be saved in localStorage as auth0.obj\n  Auth0Store.set('obj', myObj);\n\n  // This will look for auth0.obj\n  var myNewObject = Auth0Store.get('obj');\n\n  angular.equals(myNewObject, myObj); // return true\n});\n````\n\n## Changing storage type\n\n```js\nangular.module('app', ['angular-storage'])\n  .config(function(storeProvider) {\n    // Store defaults to localStorage but we can set sessionStorage or cookieStorage.\n    storeProvider.setStore('sessionStorage');\n  })\n  .controller('Controller', function(store) {\n\n  var myObj = {\n    name: 'mgonto'\n  };\n\n  // This will be saved in sessionStorage as obj\n  store.set('obj', myObj);\n\n  // This will look for obj in sessionStorage\n  var myNewObject = store.get('obj');\n\n  angular.equals(myNewObject, myObj); // return true\n});\n```\n\n\n## API\n\n### storeProvider.setStore(storageName)\n\nSets the underlying store for the `store` service. It can be `localStorage`, `sessionStorage` or `cookieStorage`. Defaults to `localStorage`\n\n### store.set(name, value)\n\nSets a new `value` to the storage with the key `name`. It can be any object.\n\n### store.get(name)\n\nReturns the saved `value` with they key `name`. If you saved an object, you get an object.\n\n### store.remove(name)\n\nDeletes the saved `value` with the key `name`\n\n### store.getNamespacedStore(namespace, delimiter)\n\nReturns a new `store` service that will use the `namespace` and `delimiter` when saving and getting values like the following `namespace[delimiter]key`. For example `auth0.object` considering `auth0` as `namespace` and `.` as a `delimiter`\n\n## Usages\n\nThis library is used in [auth0-angular](https://github.com/auth0/auth0-angular)\n\n## Contributing\n\nJust clone the repo, run `npm install`, `bower install` and then `gulp` to work :).\n\n## Issue Reporting\n\nIf you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.\n\n## Author\n\n[Auth0](auth0.com)\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fangular-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fangular-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fangular-storage/lists"}