[英]How to call custom query URL using Restangular?
I want to call URL with special charecters in query parameter using Restangular customGET
method. 我想使用Restangular
customGET
方法在查询参数中使用特殊customGET
调用URL。 I am using Loopback for my API, which uses square brackets for query. 我正在为我的API使用Loopback,它使用方括号进行查询。 It seems it's not allowed in Restangular.
似乎在Restangular中不允许这样做。
I want to call following URL. 我想调用以下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. 作为一个解决方案我使用
$http
但黑客攻击是当天的黑客。
You should do: 你应该做:
Restangular.all("employees").customGET("findOne", {"filter[where][salesCode]": newValue});
That should do it :). 应该这样做:)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.