I have a route on my server that is designed to handle a list of objects passed through a GET request. It does this by flattening fields of the same name.
For example:
GET http://example.com/services/echo?list=Hello&list=Stay&list=Goodbye
would be deserialized to a list containing ['Hello', 'Stay', 'Goodbye']
How would I replicate this behavior when using Angular's $http
service? One way is to build the URI string manually. Another is to configure the servlet to deserialize the list from one field. But is there a cleaner way to do this, eg by using the config
object?
This might work
$http({method: 'GET', url: '/someUrl',params:{list:['foo','bar']}).
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
}).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.