I'm trying to pass a nested set of query params to my Laravel 5.1 API. I'm using $httpParamSerializer(params) the serialize the object, which seems to do it correctly as the GET looks like:
GET "http://ift.tt/29v3V63"
Yet, when I return the $request from Laravel, it shows only one of the properties:
Object {category: "Consent Forms"}
Why is this?
Angular Frontend:
var filters = {
category : ['Anatomy', 'Consent Forms']
};
Category.getCategories(filters).then(function(res) {
// Object {category: "Consent Forms"}
console.log('CATEGORIES', res.data);
Angular HTTP Request:
getCategories: function(params) {
var qs = $httpParamSerializer(params);
return $http({
method: 'GET',
url: url + ver + '/categories?' + qs,
headers: Auth.getOAuthHeader(),
cache: true
});
},
Laravel:
public function getCategories(Request $request) {
$input = $request->all();
return $input;
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire