title: AngularJS - always have a param as a default for a Resource
body: <p>Basically I got a scenario where the API i'm accessing uses a :groupId as a part of the url in many cases. Is there a easy way to avoid passing $routeParams.groupId in each function call?</p>
  
  <pre><code>var app = angular.module('plunker', []);
  
  app.config(["$routeProvider", function($routeProvider) {
    $routeProvider.
      when("/:groupId/location", {templateUrl: "partials/location.html", controller: "LocationCtrl"});
  }]);
  
  /* Controllers */
  app.controller('LocationCtrl', function($scope, $routeParams, Location) {
    Location.groupId = $routeParams.groupId; /* Is this even possible? I want to have it available to Location instead of the below*/
    Location.query();
  
    Location.query({groupId: $routeParams.groupId});
  });
  
  /* Services */
  app.service("Location", function($resource, $routeParams) {
    return $resource("/api/:groupId/location", {}, {
      query: {method: "GET", isArray: true}
    });
  });
  </code></pre>