In my application I have several forms, and if a user enters some data
in a form and does not save it and then tries to navigate away from
the form (the current route changes), I would like to be able to show
a dialog saying like "You have unsaved data. Are you sure you want to
navigate away from this page?". Is it possible to somehow prevent a
route change with the current $route implementation?
Best regards,
Adam Pohorecki
Thanks,
Adam
> --
> You received this message because you are subscribed to the Google Groups
> "angular" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/g5zWtPglmEAJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.
>
I was looking at this problem too, tried the above (old solution) without luck, i thought about making all my links check a service but that is too much work, it would be great to have a way to know that the route is about to change (a before route change event) and a cancel route change method.In my research i stumbled upon $routeChangeSuccess, but as the name suggest it is too late, you could make one stuck on one view buy redirecting back, but you lose all context as the controller will execute again, my current use for it is to redirect user to login screen in case he is not logged inhope someone else chime in this issue
On Wednesday, July 18, 2012 9:57:39 AM UTC-3, Chadd Whistler wrote:So this doesn't appear to work with the current 1.0.1 version. Are there any other alternatives?Just some more background, I am working on a financial application so I need to have complete control over navigation which includes changes directly to the URL in the address bar, the browser forward/back buttons and links from within my application.