
Elo Mirki z #angular #angularjs
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123})
.$promise.then(function(user) {
$scope.user = user;
});
Po co ten '@id'?
Przykład z dokumentacji tutaj: https://docs.angularjs.org/api/ngResource/service/$resource
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123})
.$promise.then(function(user) {
$scope.user = user;
});
Po co ten '@id'?
Przykład z dokumentacji tutaj: https://docs.angularjs.org/api/ngResource/service/$resource
- Najlepsze
- Wszystkie komentarze







Nie jestem przy kompie ale masz przykład z apki google:
phonecatServices.factory('Phone',
If the parameter value is prefixed with @ then the value for that parameter will be extracted from the corresponding property on the data object (provided when calling an action method). For example, if the defaultParam object is {someParam: '@someProp'} then the value of someParam will be data.someProp.