Indeed, you can accomplish what you’re after by adding a ‘then’ handler to
your Projects service that returns only the data relevant to the caller.
For example:
miff.factory('Projects', function($cordovaSQLite) {
return {
all: function () {
var query = "SELECT id, title from projects";
return $cordovaSQLite.execute(db, query).then(function (result) {
return result.rows;
});
}
}
});
This works because returning a value in a then handler provides a new
resolve value, so when the controller’s then handler is invoked (remember,
it’s added *after* the one defined in the service), it will only receive
row data.
Obviously you’d want to add in whatever error handling & etc. belongs in
the service.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.