通过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; })