I have a child resource -- image -- to a parent resource -- exhibit, and my RESTful api is currently set to /exhibit/:exhibitId/media/:mediaId for that image, and /exhibit/:exhibitId for the exhibit list. I want to use $resource, if possible, to query the image from the exhibit, and I currently have this as my code:
angular.module('media',['ngResource']).
factory('Image',function($resource){
return $resource('/exhibit/:exhibitId/media/:mediaId',{},{update:{method:'PUT'},query:{method:'GET',isArray:false}});
});
I would wish that in my controller, I could just use Image.query(), and have it magically guess the exhibitId and insert it there, but that is obviously not possible. Should I just extend my exhibit resource
angular.module('exhibit',['ngResource']).
factory('Exhibit',function($resource){
return $resource('/exhibit/:exhibitId',{},{update:{method:'PUT'},query:{method:'GET',isArray:false}});
});
to get the list of images, or is there something I'm missing?