繁体   English   中英

如何使用Restangular调用自定义查询URL?

[英]How to call custom query URL using Restangular?

我想使用Restangular customGET方法在查询参数中使用特殊customGET调用URL。 我正在为我的API使用Loopback,它使用方括号进行查询。 似乎在Restangular中不允许这样做。

我想调用以下URL。

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

或者这个但不确定如何。

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

我试过跟随没有成功。

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

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

作为一个解决方案我使用$http但黑客攻击是当天的黑客。

你应该做:

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

应该这样做:)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM