code: function(url) {
      if (isUndefined(url)) {
        return this.$$url;
      }
  
      var match = PATH_MATCH.exec(url);
      if (match[1] || url === '') this.path(decodeURIComponent(match[1]));
      if (match[2] || match[1] || url === '') this.search(match[3] || '');
      this.hash(match[5] || '');
  
      return this;
    }
docs: @ngdoc method
  @name $location#url
  
  @description
  This method is getter / setter.
  
  Return url (e.g. `/path?a=b#hash`) when called without any parameter.
  
  Change path, search and hash, when called with parameter and return `$location`.
  
  
  ```js
  // given url http://example.com/#/some/path?foo=bar&baz=xoxo
  var url = $location.url();
  // => "/some/path?foo=bar&baz=xoxo"
  ```
  
  @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
  @return {string} url