title: Angular: parse a URL into a route and params without following that URL?
body: <p>Suppose I have an Angular app using a <code>$routeProvider</code> that I've initialized similarly to the following:</p>
  
  <pre><code>$routeProvider
    .when('/foo/:var1', {
      templateUrl: 'templates/template-1.html',
      controller: 'SomeController'
    })
    .when('/bar/:var2a/:var2b', {
      templateUrl: 'templates/template-2.html',
      controller: 'SomeOtherController'
    })....
  </code></pre>
  
  <p>Now suppose I have a URL and I want to know information about the route it will map to (in particular, which route parameters it contains and what their values are) without actually following that route.  Does an angular service such as <code>$route</code>, <code>$routeParams</code>, or <code>$routeProvider</code> provide a function that will, given a URL, return that information to me?</p>
  
  <p>As an example, if my site was hosted at <code>example.com</code> and I called such a function passing in the argument <code>'http://example.com#/bar/2/blue'</code>
  I'd like it to return (something that contains) an object like</p>
  
  <pre><code>{ var2a: 2, var2b: 'blue' }
  </code></pre>
  
  <p>I thought since Angular's routing service clearly has the capability to map URLs from the browser's address bar to a route and list of params, there might be a way to harness this functionality for any URL in my application without actually navigating to that URL.  Is there?  If not, is there a third-party library/plugin that can integrate with Angular and do this?</p>
  
  <p>(In case you're curious:  my reason for wanting this is so that if the user deletes an entity in my application, I can clear out any URLs in the application's "recently visited" shortcut list that reference that entity's ID so that the user doesn't try to navigate to an item that no longer exists.)</p>
  
  <p>Thank you to anyone who helps!</p>