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

fus*_*ngs 6 javascript angularjs restangular loopbackjs

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

我想调用以下URL.

/api/v1/employees/findOne?filter[where][salesCode]=SC2
Run Code Online (Sandbox Code Playgroud)

或者这个但不确定如何.

/api/v1/employees?filter[where][salesCode]=SC2
Run Code Online (Sandbox Code Playgroud)

我试过跟随没有成功.

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

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

作为一个我正在使用的工作,$http但黑客是一天的黑客.

mgo*_*nto 11

你应该做:

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

应该这样做:).