我想使用这种URL构建资源:
?/ API / V1 /用户的用户类型= PREMIUM&安培; param2的=值2
return $resource("/api/v1/users?userType=PREMIUM¶m2=value2, {},
{ 'get' : {method:'GET' },
'save' : {method:'POST' },
'query' : {method:'GET' },
'remove': {method:'DELETE'},
'delete': {method:'DELETE'}
});
我想参数化" userType"。我怎么做 ?
答案 0 :(得分:0)
// our custom method is mapped as well.
card.$charge({amount:9.99});
// POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
=============================================== ================================
PUT应该与POST具有相同的行为,因为你不能用' @'来定义参数。 (在这种情况下,'金额')将被添加为查询参数。但是,如果你在PUT资源的定义中有{id:' @ id',金额:' @ amount'然后它将作为JSON传递