javascript - Angular Resource not sending request to API -
i writing basic crud angular app of sorts , have been using $resource
throughout. issue when trying issue request api endpoint getting error in resource:
[log] object (job-detail.js, line 30) config: object headers: object method: "get" transformrequest: array[1] transformresponse: array[1] url: "http://127.0.0.1:8000/estimators/1" __proto__: object data: null headers: function (name) { arguments: function () { caller: function () { length: 1 name: "" prototype: object set arguments: function () { set caller: function () { __proto__: function () { status: 0 statustext: "" __proto__: object
i have no idea going wrong because have tested url , works fine. also, have used $resource
in exact same fashion, on different endpoint , working fine. lastly, $resource
isn't sending request, on api it's not logging requests endpoint. @ loss, here relevant code:
angular.module('lincorfeapp.controllers') .controller('jobdetailctrl', ['$scope', '$routeparams', 'estimator', '$location', function($scope, $routeparams, estimator, $location) { getestimator(); function getestimator() { $scope.estimator = estimator.get({ pk : $scope.job.estimator }, function() { console.log($scope.estimator.name); }, function(response) { console.log(response); }); } }
]);
and in services.js
:
myapp.factory('estimator', function($resource) { return $resource('http://127.0.0.1:8000/estimators/:pk', { pk : '@pk' }, { update : { method: 'put' }, delete : { method: 'delete' } }); });
any appreciated!
Comments
Post a Comment