I'm having a problem using AngularJS resources.
I have a resource that looks like this:
loginModule.service('TestResource', function ($resource, $location) {
var $scope = this;
$scope.resource = $resource(window.location.path+'/:event', {event:'@event'});
$scope.inputData = function(data1, data2, success){
return $scope.resource.save({'event':'inputData'},{'data1':data1,'data2':data2},success);
};
return $scope;
});
And yes, I've tried using:
// $scope.resource = $resource($location.path()+'/:event');
// $scope.resource = $resource(window.location.path+'/:event');
// $scope.resource = $resource(':event');
Firebug reports that the address this tries to send to is one of these two:
http://localhost/sandbox/test/undefined/inputData
http://localhost/sandbox/test/:event?event=inputData
What I want is an address of:
http://localhost/sandbox/test/inputData
What am I doing wrong? More specifically, what should I do to make it right?
$resource('/:event'...)?http://localhost/inputDatahttp://localhost/sandbox/test/:event?event=inputData./:event