You seem to be mixing up the request data
field with the response data
. As stated in the AngularJS $http API:
The request data should be provided for POST/PUT requests, as seen in
$http.post('/someUrl', data, config).then(successCallback, errorCallback);
Instead of focusing on the request data
, consider adding a parameter for the response data
in your successCallback
.
Below is an example code snippet that illustrates this:
$http.get('/categories/graph')
.then(function successCallback(res) {
$scope.scopeGraph = res.data;
}, function errorCallback(err) {
console.log("Error: " + angular.toJson(err));
});
In this example, the res
variable in the successCallback
is used to extract the response data without needing to specify the request data
for a get
request.