Open erochaamorim opened 9 years ago
My apologies for taking so long in getting back to you.
I don't think I quite understand your difficulty.
Find is really really simple... https://github.com/bramski/angular-indexedDB/blob/master/src/angular-indexed-db.coffee#L421
It just issues a "get" with the identifier you requeested against the underlying store. I suspect your problem is really simple, like using a string for the identifier instead of turning it into an integer as your object actually refers to it. Make sure your types are correct is my suggestion.
Hello, how are you doing?
I started using angular-indexedDB today, but I'm having dificulties working with the store.find() function.
You see, I'm defining a store like this:
... and I'm able to have insert() and getAll() work as I expected. But, when I try to use the store.find(), like this:
... it simply, doesn't works.
I already have certified (through simple debugging with console.log) that the $state.params are well-formed, and correct, also that there's an entry which possesses a property id equal to the parameter, when the function is called.
Could it be that the store.find() function does not behaves properly when the store have a keyPath and a keyGenerator (autoIncrement) ?
--UPDATE 09/08/2015--
Greetings.
I was able to make it work as I wanted, but I had to pass the entire campaign object through the params, instead of only the id:
It seems the store.find() function does not performs a deep comparison between the store.key and the value passed as argument, what would explain why passing a by-copy value (instead of the actual reference) does not works.
Also I'm not sure if the store.find() function's key comparison takes data type (primitives, like String, Number, etc) into account.