title: prevent redirect behaviour in angularjs app
body: <p>When a user tries to click browser back button and dere is dirty data on the form, it shows a confirmation.</p>
  
  <p>Here is the angular js controller code</p>
  
  <pre><code>   function MyCtrl2($rootScope, $location, $scope) {
  
      $rootScope.$watch(function () {
          return $location.path();
      },
  
      function (newValue, oldValue) {
          if ($scope.myForm.$dirty) {
              var a = confirm('do you');
              if (!a) {
                   //how to prevent this redirect
              }
          }
      },
      true);
  }
  
  MyCtrl2.$inject = ['$rootScope', '$location', '$scope'];
  </code></pre>
  
  <p>But how to prevent the redirect on</p>