Closed seanmavley closed 8 years ago
You have no catch. Are you sure the first function succeeds a second time? You're using insert and not upsert so perhaps the insert is failing due to a key clash but you're not seeing the transaction error. I'm guessing that ssn is your key property?
Try putting together a gist if that fails. On Apr 1, 2016 6:33 AM, "Nkansah Rexford" notifications@github.com wrote:
Kindly see this snippet in the README: `angular.module('myModuleName') .controller('myControllerName', function($scope, $indexedDB) {
$scope.objects = [];
$indexedDB.openStore('people', function(store){
store.insert({"ssn": "444-444-222-111","name": "John Doe", "age": 57}).then(function(e){...});
store.getAll().then(function(people) { // Update scope $scope.objects = people; }); });
});`
The store.getAll() should probably come out of that indexedDB.openStore(....) { ... } block.
When I tried the above snippet, the objects are added on first time, if the db doesn't exist, but subsequent ones, no retrieval happens
I did this and it works fine:
$indexedDB.openStore('myStop', function(store) { store.getAll().then(function(data) { // Update scope $scope.objects = data; }); });
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/bramski/angular-indexedDB/issues/60
Yep, true. I'm using insert function, and without an error function. And yes, there's a key clash. However, it isn't clear from the docs, with the insert embedded in the openStore block. Might be confusing for newbies like myself when they realize insert worked, but results doesn't show the second time.
Not a bug report, but just a doc clarification
Feel free to make an addition to the Readme you feel would be helpful. On Apr 1, 2016 7:05 AM, "Nkansah Rexford" notifications@github.com wrote:
Yep, true. I'm using insert function, and without an error function. And yes, there's a key clash. However, it isn't clear from the docs, with the insert embedded in the openStore block. Might be confusing for newbies like myself when they realize insert worked, but results doesn't show the second time.
Not a bug report, but just a doc clarification
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/bramski/angular-indexedDB/issues/60#issuecomment-204408773
Kindly see this snippet in the README: `angular.module('myModuleName') .controller('myControllerName', function($scope, $indexedDB) {
});`
The
store.getAll()
should probably come out of thatindexedDB.openStore(....) { ... }
block.When I tried the above snippet, the objects are added on first time, if the db doesn't exist, but subsequent ones, no retrieval happens
I did this and it works fine: