title: AngularJS resource: Send query parameter only if non-empty
body: <p>I have a Angularjs resource and in one of the methods, I want to send a query parameter to the backend if that query parameter is non-empty. Is it possible to achieve that without created a different method?</p>
  
  <p>Example resource method:</p>
  
  <pre><code>get: {
        method: 'GET',
        url: /api/:token?source=:source,
        paramSerializer: someSerializer
      },
  </code></pre>
  
  <p>The code to call the method is,</p>
  
  <pre><code>myResource.get({token: '1234'}, {source: &lt;some source&gt;});
  </code></pre>
  
  <p>The token is required, but the source is optional, so sometimes it is not passed in to the call above. So if a value is provided for the source, I want to be able to send the source. If the source value is not provided, I want to not send the source at all. For instance, the call will become /api/1234 if source is empty, and the call will become /api/1234?source=some_source if the source is set as some_source.</p>
  
  <p>With the code above, if the source is empty, I see that the request is '/api/1234?source=' when the source is empty. </p>