I would appreciate any help in figuring out something about the code below. Specifically, how does Angular determine that it should inject the response of the resource request into authenticationResult?
myApp.controller(...{
................
$scope.login = function() {
UserService.authenticate($.param({username: $scope.username, password: $scope.password}),
function(authenticationResult) {
...........
} );
var services = angular.module('myApp.services', ['ngResource']);
services.factory('UserService', function($resource) {
return $resource('/restendpoint/:action', {},
{
authenticate: {
method: 'POST',
params: {'action' : 'authenticate'},
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}
}
);
});