mgonto / restangular

AngularJS service to handle Rest API Restful Resources properly and easily
MIT License
7.87k stars 840 forks source link

How to set array of object as parameters using customGET ? #1477

Closed ridoansaleh closed 6 years ago

ridoansaleh commented 7 years ago

I have an object which contains an array as one of its property.

var filter = {
  category: 1,
  page: 1,
  product: 20,
  price_range: ['bt', 1, 150]
}

Then in the service to get data

getRawList: function(filter) {
  return rawProducts.customGET("",{
    category: filter.category,
    page: filter.page,
    page_size: filter.page_size,
    'price_range[]': filter.range_price,
    shipping: filter.shipping,
    color:filter.color,
    brands: filter.brands
  }).then(function successCallback(response) {
    response.category = filter.category;
    return response;
  }, function errorCallback(response){
    console.log(response);
  });
}

It doesn't display an error AND it doesn't display the correct data as well.