javascript - AngularJS resource not forming url correctly -
i'm having problem using angularjs resources.
i have resource looks 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 address tries send 1 of these two:
http://localhost/sandbox/test/undefined/inputdata http://localhost/sandbox/test/:event?event=inputdata
what want address of:
http://localhost/sandbox/test/inputdata
what doing wrong? more specifically, should make right?
try $resource('./:event', ...)
Comments
Post a Comment