Reputation: 6188
In my controller:
UserResource.find({ userId: userId }, function (records) {
$scope.user= records;
});
In my resource:
angular.module("main_k").
factory("main_k.service.resource.Order", ["$resource", function ($resource) {
return $resource("../rest/user/:action?:identification", {
action: "@userId",
identification: "identification51854"
}, { find: { method: "GET"}
});
}]);
The problem is that the userId gets appended to the url instead of to be filled in, into action. Identification is filled in correctly. What am I doing wrong in order to pass the userId value?
Upvotes: 0
Views: 79
Reputation: 54514
This is kinda weird. When you do GET request you need to set the original variable name :action
instead of userId
if you want to interpolate it the path.
UserResource.find({
action: userId
}, function (records) {
$scope.user = records;
});
Upvotes: 1