title: Previous Page in Angular.js
body: <p>i am working in AngularJs and i have a problem. </p>
  
  <p>When the user push the login button, the page go back to the previous page, but i only want go back if one of the routeprovider page and go to "/" route if teh previous page is another page. Actualy i use:</p>
  
  <pre><code>       if (history.length &gt; 1)
          {
              history.back();
          }
          else
          {
              $location.url("/");
          }
  </code></pre>
  
  <p>How can i see the previous page url and compare it?</p>