angular-ui/ui-router — pull request #587 by ggoodman (2013-11-15 21:44:37+00:00)
Title: Add `onBeforeExit` similar to `window.onbeforeunload`

Example:

```javascript
{
...
onBeforeUnload: ['$window', 'dirty', function($window, dirty) {
if (dirty.isSessionDirty()) return $window.confirm("Are you sure you would like to navigate?"));
else return true;
}
...
}
```