'use strict';
angular.module('rmaServices', ['ngResource'])
.factory('rmaService', ['$resource',
function ($resource) {
return $resource(
'/RMAServerMav/webresources/com.pako.entity.rma/:id',
{},
{
delete: { method: 'DELETE', params: {id: '@rmaId'}},
update: { method: 'PUT', params: {id: '@rmaId'}},
//RMAServerMav/webresources/com.pako.entity.rma/0/3
findRange:{method: 'GET', params:{id:'@rmaId'/'@rmaId'}}
});
}]);
RMAServerMav/webresources/com.pako.entity.rma/0/3
This is correct way to use findRange REST service. This one returns the rmaID from 1 to 4, but how can I use this from controller and what is the correct syntax in service?
In controller I would like to use it something like that:
$scope.rmas = rmaService.findRange({id:'0'/'3'});
but this is not working.
You can override url, Read $resource docs
In resource declaration
In Controller
I would prefer shorter way of defining parameters. Here is a complete example.
We have here 2 params :latitude and :longitude they defined only in the URL. Method get is already defined by ngResource
Try changing your service using it in the controller like this:
I have no idea if this will work BTW, because I have no use ngResource but that is how I code my factory services.