When using the deferred method offered by angularjs and querying the database local storage, the "resolve" doesn't seem to work. See the following example. The "then" action is never fired. When trying with a setTimeout instead of the "Person.all()" instruction, it works.
var defer = $q.deferred();
Person.all().list(null, function (persons) {
defer.resolve(persons);
});
defer.promise.then(function (persons) {
console.log('resolved');
});
Thanks for helping.
For Angularjs's promise, then only fires in digest cycle.
If your Person object is in your service, you can inject $rootScope and
call $apply() against it to let then fire.