I'm encountering an issue with AngularJS resources.
The resource I have is structured as follows:
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;
});
I have experimented with using:
// $scope.resource = $resource($location.path()+'/:event');
// $scope.resource = $resource(window.location.path+'/:event');
// $scope.resource = $resource(':event');
According to Firebug, the URL it is attempting to access is one of the following:
http://localhost/sandbox/test/undefined/inputData
http://localhost/sandbox/test/:event?event=inputData
However, I am aiming for the URL to be:
http://localhost/sandbox/test/inputData
What could be the issue here? What steps should I take to address this?