Just started to use Hood.ie for a web app, however am facing issues in obtaining some data.
I want to get the data and then simply do something like
hoodie.store.find('teammember', theId).firstName;
Is this possible?
Thanks.
Just started to use Hood.ie for a web app, however am facing issues in obtaining some data.
I want to get the data and then simply do something like
hoodie.store.find('teammember', theId).firstName;
Is this possible?
Thanks.
What you are looking for is
Most methods of Hoodie are asynchronous and return promises. A promise is an object with methods to which you can pass callback function. By standard, a Promise has .then & .catch methods, Hoodie also adds .done & .fail. .done(callback) gets called when the method succeeded. .fail(callback) gets called when it failed. .then(callback) and .catch(callback) additionally allow to chain the callbacks.
Find more information on Promises here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise And a great article on common gotchas here: http://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html