Question: I'm struggling to handle the back button and ask confirmation to the user, if app state is dirty. Closing tab and reload is already handled via the `onbeforeunload` hook.

I've played with `$routeChangeStart`, `$beforeRouteChange`, etc. but can't handle it correctly.
With `$routeChangeStart`, the route is effectively changed before my callback is called.

What is the correct way to handle this situation?

Thanks for your help.

Answer: 
I believe $locationChangeStart fires when you would like it to.
you could use:

```
$scope.$on('$routeChangeStart', function(next, current) { 
   //broadcasted before a route change
   // do something here
});

```

See more of it on : [$route](http://docs.angularjs.org/api/ng.%24route)