我有一个简短的问题。在 Angular js 中,“@id”来自 Rails 应用程序的以下代码片段中的哪里(比如哪个对象)?
var User = $resource("/users/:id", {id: '@id'});
我知道它设置了默认 ID。
谢谢
最佳答案
来自 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)."
这意味着当调用非 GET 操作(如 POST)时,您可以将 id 作为调用中包含的数据对象的字段之一传递。
关于javascript - Angularjs ngResource '@id',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15059764/