我正在使用AngularJS与已经构建的REST服务集成.
REST API使用以下表单进行查询:
http://the.site/person/search/smith%20male(这会搜索名为史密斯的男性人物)
我知道这个表单并不是最好的,最终会将API更改为使用URL参数.
目前我只是在我的控制器中定义一个资源:
$scope.Summary = $resource("http://the.site/person/search");
this.Summary.query({ terms : 'smith male' });
Run Code Online (Sandbox Code Playgroud)
但是会生成表格/ person/Search?terms = smith%20male的URL
有没有办法修改或覆盖使用的URL?我更熟悉Backbone,我能够在我的url()函数中生成正确形式的URL.
小智 5
$scope.Summary = $resource("http://the.site/person/search/:terms");
this.Summary.query({ terms : 'smith male' });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
849 次 |
| 最近记录: |