title: AngularJS: Get previous url (path) from page
body: <p>I have a question: When I'm in a page I want return to previous page. I use the <code>$routeProvider</code>. How can I read the previous url?</p>
  
  <p>I try to use this code in my controller but doesn't work...</p>
  
  <pre><code>angular.module.controller('myController', 
    function($scope, $routeParams, $http, $location, $rootScope) {
  
      $rootScope.$on("$routeChangeSuccess", 
        function (event, current, previous, rejection) {
  
          console.log(previous);
          $location.path('PREVIOUS PATH');
  
      });
   });   
  </code></pre>
  
  <p>How can I read the previous path? Thanks!</p>