title: Get the URL path without the params
body: <p><strong>Goal</strong>:<br/>
  The main idea is about getting $location.path() without the <code>:param</code> that set in the route provider.</p>
  
  <p><strong>Description</strong>:<br/>
  Assume that my app has to define randomly paths with one param.
  So I'll use loop function to define all of them for clean code and DRY issue.</p>
  
  <p>For example:</p>
  
  <pre><code>// get pool of paths from server and set them dynamically
  pathsApi.get().then(function(res){
     // just example for demonstrate
     res.data = ['search1','search2','search3','search4'];
     angular.forEach(res.data, function(route,key){
        .when('/search/' + route + '/:search', route.resolve('Search', '/', 'svm'));
     });
  });
  
  // other regular paths
  .when('/home', route.resolve('Home', '/', 'hvm'));
  .when('/help', route.resolve('Help', '/', 'hlvm'));
  </code></pre>
  
  <p>Grat. Everything works fine. now i have a lot of paths i can access.</p>
  
  <p><strong>Problem / Advice I need</strong>:<br/>
  I have a directive that do some things.
  One of them is to check if the location contain the word search, and if it is, I want to get the name of the route of the search.</p>
  
  <p>For example:</p>
  
  <p>The user go to <code>/#/search/search3/someText</code>.<br/>
  I want to get <code>/#/search/search3</code>.</p>
  
  <p>Of course I can use split and other techniques. But I know that angular knows that <code>someText</code> is a param (which is called <code>:search</code>).
  So I'm sure that angular can tell me what is the $location.$path without the <code>:search</code> so it will be only the path like I mentioned before.</p>
  
  <p>I'm looking for elegant way through angular without the messy code, splits or assumptions.
  I don't want to use $location.search or $location.hash instead. I want to save the URL scheme as is.</p>