title: Angularjs $location service apparently not parsing url?
body: <p>I'm using angular in an application which is, basically, a table with search results. 
  Access to this table can be achieved via an url like <code>http://myapp/?client=clientName</code></p>
  
  <p>An angular controller is instantiated for the table, among other things, for opening a modal dialog (also angular-based with bootstrap-ui) with the row details.</p>
  
  <p>These row details are brought via a service which has some common functionality for both controllers: the one for the table and the one for the modal.</p>
  
  <p>Now, within this service, I have the following snippet to retrieve:</p>
  
  <pre><code>service.fetchRelatedElements = function(element, cb) {
    var url = '/search.json?results=20&amp;type='+element.type;
    if ($location.search()['client']) {
      url += '&amp;client=' + $location.search('client');
    }
    return doFetch(url, cb); // actual server json GET
  };
  </code></pre>
  
  <p>The goal is to know if the table already has this specific <code>client</code> parameter set as a filter.</p>
  
  <p>If I put a breakpoint at the beginning of this call, I see that <code>$location.absUrl()</code> returns the current browser URL (which, in my case, has the <code>client</code> parameter I'm interested in).</p>
  
  <p>But <code>$location.search()</code> returns an empty object.</p>
  
  <p>I am injecting the $location service within my service with the defaults (that is, not configuring it by a <code>.config()</code> call).
  And, as doc says: </p>
  
  <blockquote>
    <p>The $location service parses the URL in the browser address bar (based
    on the window.location) and makes the URL available to your
    application.</p>
  </blockquote>
  
  <p>Am I missing something? Shouldn't the URL, at this point, be parsed?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> I've managed to make it work. The problem was exactly that I wasn't configuring at all the service. I did so because I assumed that in that way it would take defaults, but it seems that that's not the way it works.</p>