Reputation: 117
I have problem with sending variable by http.get, can someone correct me?
$http.get("/product/products", { 'quantity': 5 }).then(function (resp) {
$scope.products = resp.data;
})
Thanks much
Upvotes: 1
Views: 330
Reputation: 41397
cant send a request body for get
request. you can either change it to a POST
request or send the variable as params
$http.get("/product/products", { params: { 'quantity': 5 }}).then(function (resp) {
$scope.products = resp.data;
})
Upvotes: 0
Reputation: 136144
You should be sending it as params
property of config object.
$http.get("/product/products", { params: { 'quantity': 5 }})
Upvotes: 3