1
這是來自documentation。
var User = $resource('/user/:userId', {userId:'@id'});
var user = User.get({userId:123}, function() {
user.abc = true;
user.$save();
});
@id
是什麼意思?如果我們應該提供userId
作爲/:userId
指定的參數,那麼爲什麼在{userId: '@id'}
中再次指定此規則(假設這意味着什麼)。
的可能重複[AngularJS $ @資源前綴參數(http://stackoverflow.com/questions/13187823/angularjs-resource-prefixed-parameter) –
閱讀此篇http://stackoverflow.com/questions/13313971/at-sign-in-parameter-name-in-resource-definition – Rob