{"id":13491510,"url":"https://github.com/webcss/angular-indexedDB","last_synced_at":"2025-03-28T08:33:16.122Z","repository":{"id":7583525,"uuid":"8939070","full_name":"webcss/angular-indexedDB","owner":"webcss","description":"An angularjs serviceprovider to utilize indexedDB with angular","archived":false,"fork":false,"pushed_at":"2015-05-08T16:09:53.000Z","size":432,"stargazers_count":149,"open_issues_count":19,"forks_count":98,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-05T20:05:10.293Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webcss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-21T21:29:49.000Z","updated_at":"2024-06-26T08:22:33.000Z","dependencies_parsed_at":"2022-08-30T07:01:04.709Z","dependency_job_id":null,"html_url":"https://github.com/webcss/angular-indexedDB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcss%2Fangular-indexedDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcss%2Fangular-indexedDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcss%2Fangular-indexedDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcss%2Fangular-indexedDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webcss","download_url":"https://codeload.github.com/webcss/angular-indexedDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245996758,"owners_count":20707311,"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":[],"created_at":"2024-07-31T19:00:57.705Z","updated_at":"2025-03-28T08:33:15.784Z","avatar_url":"https://github.com/webcss.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Storage"],"sub_categories":[],"readme":"angular-indexedDB\n=================\n\nAn angularjs serviceprovider to utilize indexedDB with angular\n\n####Important: This repository isn't maintained by me anymore. Look [over here](https://github.com/bramski/angular-indexedDB) for current versions, as [Bram Whillock](https://github.com/bramski) took over as main contributor.\n\n## Installation\n\nFor installation the use of Bower is recommended.\n\n### Bower\nCall the following command on your command line:\n\n```sh\nbower install --save angularjs-indexedDB\n```\n\nAnd add the following line to your html file, for example `index.html`:\n\n```html\n\u003cscript src=\"components/angular-indexedDB/src/indexeddb.js\"\u003e\u003c/script\u003e\n```\n\n\n### Manual\n\n- Download file.\n- Add the following line to your html file:\n\n```html\n\u003cscript src=\"indexeddb.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nNormally, and as a recommendation, you have only one indexedDB per app.\nThus in your `app.js` where you define your module, you do:\n\n```javascript\nangular.module('myModuleName', ['xc.indexedDB'])\n  .config(function ($indexedDBProvider) {\n    $indexedDBProvider\n      .connection('myIndexedDB')\n      .upgradeDatabase(myVersion, function(event, db, tx){\n        var objStore = db.createObjectStore('people', {keyPath: 'ssn'});\n        objStore.createIndex('name_idx', 'name', {unique: false});\n        objStore.createIndex('age_idx', 'age', {unique: false});\n      });\n  });\n```\nThe connection method takes the databasename as parameter,\nthe upgradeCallback has 3 parameters:\nfunction callback(event, database, transaction). For upgrading your db structure, see \nhttps://developer.mozilla.org/en-US/docs/IndexedDB/Using_IndexedDB.\n\nYou can also define your own error handlers, overwriting the default ones, which log to console.\n\n\nInside your controller you use `$indexedDB` like this:\n\n```javascript\nangular.module('myModuleName')\n  .controller('myControllerName', function($scope, $indexedDB) {\n    \n    $scope.objects = [];\n    \n    var OBJECT_STORE_NAME = 'people';  \n        \n    /**\n     * @type {ObjectStore}\n     */\n    var myObjectStore = $indexedDB.objectStore(OBJECT_STORE_NAME);\n    \n    myObjectStore.insert({\"ssn\": \"444-444-222-111\",\"name\": \"John Doe\", \"age\": 57}).then(function(e){...});\n    \n    myObjectStore.getAll().then(function(results) {  \n      // Update scope\n      $scope.objects = results;\n    });\n\n  /**\n   * execute a query:\n   * presuming we've an index on 'age' field called 'age_idx'\n   * find all persons older than 40 years\n   */\n   \n   var myQuery = $indexedDB.queryBuilder().$index('age_idx').$gt(40).$asc.compile();\n   myObjectStore.each(myQuery).then(function(cursor){\n     cursor.key;\n     cursor.value;\n     ...\n   });\n  });\n```\n\nQueryBuilder aka IDBKeyRange maybe needs some revision.\nThis is all the info you get for now, for more read the code, it's ndoc-annotated! \n\nImportant note: this software is in alpha state and therefore it's used at your own risk,\ndon't make me liable for any damages or loss of data!\n\nStatus Update: I'm sorry to say that I've abandoned angularJS for now and therefore have no plans for features or updates. This may change in the future. Apart from that I will apply updates submitted as pull requests when I find the time and see use.\n\nAnyone willing to join as active developer is welcome to drop me a note and help keep this project alive.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebcss%2Fangular-indexedDB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebcss%2Fangular-indexedDB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebcss%2Fangular-indexedDB/lists"}