2

AngularJS を使用して、既に構築されている REST サービスと統合しています。

REST API は、クエリに次の形式を使用します。

http://the.site/person/search/smith%20male (これは smith という名前の男性を検索します)

この形式が最適ではないことは承知しており、最終的には API を変更して URL パラメーターを使用する予定です。

現在、コントローラー内でリソースを定義しています。

$scope.Summary = $resource("http://the.site/person/search");
this.Summary.query({ terms : 'smith male' });

しかし、それはフォーム /person/Search?terms=smith%20male の URL を生成します

使用されている URL を変更または上書きする方法はありますか? 私は、正しい形式の URL を生成する url() 関数を提供できる Backbone に慣れています。

4

1 に答える 1

5
$scope.Summary = $resource("http://the.site/person/search/:terms");
this.Summary.query({ terms : 'smith male' });
于 2013-01-17T16:27:03.967 に答える