We have a document editor page where we'd like to prevent users from
navigating away if they have unsaved changes. Ideally we want to show a
warning to with Proceed / Cancel choice. I couldn't find any way to
intercept the routing before it happens other than by changing the loadUrl
method like this (in CoffeeScript):
@fragment = @getFragment(fragmentOverride)
A "before route" handler is passed the route action, which it can invoke,
i.e. proceed to the route. If the "before route" handler does NOT invoke
the route action, the navigation is effectively canceled.
Is there a better solution?