【发布时间】:2017-03-31 17:12:17
【问题描述】:
我有一个 angularJS $resource:
$resource("http://localhost:3000/:id",{
id: '@id'
},
{
get: {
method:'GET',
isArray: false
},
foo: {
method:'POST',
url: 'http://localhost:3000/:id/foo',
isArray: false
}
});
现在如果我打电话:
User.foo({id:'123', anotherParam: 'bar'});
这会导致 URL 'http://localhost:3000/foo' 被调用并将 id 和 anotherParam 参数作为 POST 字段传递。
我实际上希望它调用 'http://localhost:3000/123/foo' 并且只将 anotherParam 参数作为 POST 字段传递。
如何让 id 参数正常运行?
【问题讨论】:
标签: angularjs angular-resource