In the realm of $http
, the second parameter is a config object (refer to documentation). This config object, amidst other properties, recognizes a params
property:
- params –
{Object.<string|Object>}
– Assortment of strings or objects that will be serialized with the paramSerializer and attached as GET parameters.
Thus, you must provide the parameters in this manner:
var config = {
params: {
one: value,
two: value
}
}
$http.get('/someUrl', config).then(...)
Assuming the values for the parameters are '1' and '2' respectively, $http
will dispatch a GET request to the subsequent URL:
/someUrl?one=1&two=2
On a side note, it's advised to refrain from utilizing the success
and error
functions on $http
. They have been deprecated since angular 1.4.4. Instead, use the methods then
with a success and an error callback, or just a success callback followed by catch
.