6

I want to call URL with special charecters in query parameter using Restangular customGET method. I am using Loopback for my API, which uses square brackets for query. It seems it's not allowed in Restangular.

I want to call following URL.

/api/v1/employees/findOne?filter[where][salesCode]=SC2

or this but not sure how.

/api/v1/employees?filter[where][salesCode]=SC2

I tried following with no success.

Restangular.all("employees").customGET("findOne", {filter + "%5Bwhere%5D%5BsalesCode%5D": newValue});

and

Restangular.all("employees").customGET("findOne", {filter[where][salesCode]: newValue});

As a work around I am using $http but a hack is a hack end of the day.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
fusionstrings
  • 1,025
  • 2
  • 13
  • 23

1 Answers1

11

You should do:

Restangular.all("employees").customGET("findOne", {"filter[where][salesCode]": newValue});

That should do it :).

mgonto
  • 6,605
  • 2
  • 29
  • 36