通过http发送variablesget

我有通过http.get发送variables的问题,有人可以纠正我吗?

$http.get("/product/products", { 'quantity': 5 }).then(function (resp) { $scope.products = resp.data; }) 

非常感谢

您应该将其作为configuration对象的params属性发送。

 $http.get("/product/products", { params: { 'quantity': 5 }}) 

不能发送get请求的请求正文。 您可以将其更改为POST请求或将该variables作为params发送

 $http.get("/product/products", { params: { 'quantity': 5 }}).then(function (resp) { $scope.products = resp.data; })