I'm struggling to figure out how to pass a simple id parameter to my created resource.
The service in question is:
angular.
module('shared.testUser').
factory('TestUser', ['$resource',
function($resource) {
return $resource('http://127.0.0.1:4001/api/testusers/:id', {id:'@userid'});
}
]);
The component and controller that utilizes this service are:
angular.
module('logIn').
component('logIn', {
templateUrl: 'log-in/log-in.template.html',
controller: ['TestUser', function LogInController(TestUser) {
self = this;
self.testUserSet = TestUser.query();
self.oneUser = TestUser.get({userid:3});
self.testVar = 20;
}]
});
When running the code, I encounter an error on the self.oneuser
line.
Error: $resource:badcfg
Response does not match configured parameter
Error in resource configuration for actionget
. Expected response to contain an object but got an array (Request: GET )
I've attempted various approaches to adjust this line, but have been unsuccessful thus far.