with this code I am trying to send a $http.get request to my rest service:
$http({
method: 'GET',
url: '/api/item/all',
params: {
query: {
userid: 7
},
fields: 'title'
}
});
I expected to access this URL:
/api/item/all?query[userid]=7&fields=title
but I am always getting a malformed url...
So, how to proceed?
Or even better: Is it possible to pass the full request url into the url-param of $http?
In a GET request, you should pass parameters as part of the query string.
You can use the shortcut get call and pass in the query parameters in the url:
If you need to access them as scope variables, you can do that too:
Also depending on the back end you can send them as a path parameters rather then a query parameter:
Hope that helps