title: How to use AngularJS $resource custom actions?
body: <p>I've been using custom actions in a few repositories. And up until now I only had to specify the url and the method.</p>
  
  <p>For example:</p>
  
  <pre><code>updatePassword: {
    url: ENV.NITRO_PROJECT_REST_URL + '/admins/:adminId/password',
    method: 'PUT'
  }
  </code></pre>
  
  <p>But then, I had to code a custom action that had, not one, but two path parameters:</p>
  
  <pre><code>technicianModule.controller('technician.teamCtrl',
    ['$scope', '$state', '$stateParams', 'CommonService', 'TechnicianService', 'TeamService', 'TeamTechnicianService',
    function($scope, $state, $stateParams, CommonService, TechnicianService, TeamService, TeamTechnicianService) {
  
      $scope.add = function(teamId) {
        TeamTechnicianService.add(teamId, $stateParams.technicianId, function() {
          TeamService.get(teamId, function(data) {
            $scope.teams.push(data);
            $scope.unassignedTeams.splice(CommonService.getResourceIndex($scope.unassignedTeams, data), 1);
          });
        });
      };
  
    }
  ]);
  
  teamModule.factory('TeamTechnicianService',
    ['RESTService',
    function(RESTService) {
      var factory = {};
  
      factory.add = function(teamId, technicianId, callback) {
        return RESTService.TeamTechnician.add({teamId: teamId, technicianId: technicianId}).$promise.then(callback);
      }
  
      return factory;
    }
  ]);
  </code></pre>
  
  <p>So I first coded it like:</p>
  
  <pre><code>TeamTechnician: $resource(ENV.NITRO_PROJECT_REST_URL + '/teamtechnicians/:teamtechnicianId', {}, {
  add: {
    url: ENV.NITRO_PROJECT_REST_URL + '/teamtechnicians/:teamId/:technicianId',
    method: 'POST'
  }
  </code></pre>
  
  <p>But it would not work. The parameters were not passed in.</p>
  
  <p>After a few tries I found out it worked when adding some parameter definition, right before the custom action definition.</p>
  
  <p>It had to be like:</p>
  
  <pre><code>TeamTechnician: $resource(ENV.NITRO_PROJECT_REST_URL + '/teamtechnicians/:teamtechnicianId', {
    teamId: '@teamId',
    technicianId: '@technicianId'
  }, {
  add: {
    url: ENV.NITRO_PROJECT_REST_URL + '/teamtechnicians/:teamId/:technicianId',
    method: 'POST'
  }
  </code></pre>
  
  <p>Note the presence of:</p>
  
  <pre><code>teamId: '@teamId',
  technicianId: '@technicianId'
  </code></pre>
  
  <p>My understanding was then that in a $resource definition, a custom action that has more than one path parameter, requires them to be defined with @ signs.</p>
  
  <p>And not when it has only one.</p>
  
  <p>Why is that ?</p>
  
  <p>And why can't the path parameters be declared in the custom action instead of above in the resource ?</p>