Angular 覆盖操作中附加的资源查询参数 URL

Angular resource query param appended in overriden action URL

这是我的资源配置,如您所见,我在添加操作中覆盖了 url。

var CommerceService = ['$resource', 'context', function ($resource, context) {
    return $resource('api/commerces/:id', {id: 0}, {
        add: {url: 'api/commerces/new/storesNumber/:storesNumber', method: 'POST', params: {storesNumber: 0}},
        findMallStores: {url: 'api/commerces/mall/:id/stores', method: 'GET', isArray: true}
    });
}];

这就是我对特定操作的称呼

//more code
var stores = 0;
commerce.$add({storesNumber: stores}).then(function (response) {
   $location.path('/commerces/show/' + response.id);
});

这是我得到的结果。

http://localhost:8080/commerce-web/api/commerces/new/storesNumber/0?id=0

我期待得到这样的 URL

http://localhost:8080/commerce-web/api/commerces/new/storesNumber/0

这仍然有效,但我希望不会在 URL.
中附加查询参数 'id' 我究竟做错了什么?更重要的是为什么会这样?

我解决了,基本上剥离基础 URL 预期参数的技巧是传递一个空对象作为参数 -> {id: undefined}

//more code
var stores = 0;
commerce.$add({id: undefined, storesNumber: stores}).then(function (response) {
   $location.path('/commerces/show/' + response.id);
});

现在 URL 是没有基础 URL 资源参数的预期。