javascript - Angularjs ngResource '@id' - Stack Overflow

I have a quick question.In angular js where (like which object) does the '@id' e from in th

I have a quick question. In angular js where (like which object) does the '@id' e from in the following piece of code from a rails app?

var User = $resource("/users/:id", {id: '@id'});

I know it sets the default id.

Thanks

I have a quick question. In angular js where (like which object) does the '@id' e from in the following piece of code from a rails app?

var User = $resource("/users/:id", {id: '@id'});

I know it sets the default id.

Thanks

Share Improve this question asked Feb 25, 2013 at 3:47 GTDevGTDev 5,51810 gold badges50 silver badges84 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

From the AngularJs documentation:

"If the parameter value is prefixed with @ then the value of that parameter is extracted from the data object (useful for non-GET operations)."

This means that when calling a non-GET operation, like POST, you can pass the id as one of the fields of the data object you include in the call.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745366105a4624585.html

相关推荐

  • javascript - Angularjs ngResource '@id' - Stack Overflow

    I have a quick question.In angular js where (like which object) does the '@id' e from in th

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信