Detecting navigations (changes in the path, for example)
38 views
Skip to first unread message
lightscalar
unread,
Feb 9, 2012, 2:53:54 PM2/9/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to AngularJS
Howdy.
How would you detect when a user navigates to a different route. For
example, I have a user entering information in a text area associated
with one controller/template, I want to ensure the information is
saved when he navigates away from this form to another route.
I'd like to some how use beforeRouteChange to detect when the user is
navigating away, asynchronously save the form data, sending him on his
way.
Any ideas?
Thanks
lightscalar
unread,
Feb 9, 2012, 4:03:52 PM2/9/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to AngularJS
AH. Answered my own question.
Just had to figure out how to listen to the event properly. A call to:
$rootScope.$on('$beforeRouteChange', function () {...})