I'm building out a little app and the first thing I need to do is make a call to Parse's REST API using AngularJS's ngResource.
I've successfully constructed two Parse classes (let's call them "Parent" and "Child" for now) and set up a many-to-many relation between them such that a Parent can relate to zero-n Child objects and a Child may relate to zero-n Parent objects.
So far, the very basic stuff works fine. This method, for example, successfully retrieves all the Parent objects:
.factory('Parent', function($resource, appConfig) {
return $resource('https://api.parse.com/1/classes/Parent/:id', {}, {
list : {
method : 'GET',
headers: appConfig.parseHttpsHeaders
}
});
})
Awesome. It even has a "Child" attribute describing the relation (as you would expect) but does not return the actual Child objects inside each Parent.
Now I need to expand on this method to retrieve the related Child objects at the same time - I really don't want to have to make another call per Parent to get the related Child objects.
So we try this:
.factory('Parent', function($resource, appConfig) {
return $resource('https://api.parse.com/1/classes/Parent/:id', {}, {
list : {
method : 'GET',
headers: appConfig.parseHttpsHeaders,
params : {
'include' : 'Child'
}
}
});
})
...and the server returns...the exact same response as before. The Child records are not included.
Any ideas where I'm going wrong?
Edit: Note that while I've set up the Parent and Child relation already, I'm open to suggestions if this is not the best way of doing things if I need to query the data in this way. There will be a limited set of Parent objects (let's say under 100) and a much smaller set of possible Child objects (under 30).