-
Notifications
You must be signed in to change notification settings - Fork 24.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent navigation from nested component #8722
Comments
What Angular2 version, what Router version |
Angular 2.0.0-beta.6 |
In beta.6 there is only one version. Since RC.0 there are two (the one already in beta.6 and a new one). #8477 is about the new one. I don't expect fixes for the old one anymore. |
So this should be fixed by updating my version? |
Nope - "(not yet released)". Probably when Angular2 RC.2 is released. You'd also need to migrate to the new router. |
This issue was made obsolete by router v3: https://angularjs.blogspot.com/2016/06/improvements-coming-for-routing-in.html This particular feature is available in router v3. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
have a component which is set to a be inserted in some route. I want to write another more general component, that I can place in that first component and will prompt the user when he trys to navigate away from the first component route and ask him if he is sure he wants to leave
I tried to use CanDeactivate in this Leave Dialog component but it is never being called (when switching routes).
Steps to reproduce and a minimal demo of the problem
I have asked a question about this in stack over flow with more explanation and a code sample:
[http://stackoverflow.com/questions/37118511/prevent-navigation-from-nested-component-in-angular-2](prevent navigation from nested component)
Current behavior
The routerCanDeactivate method isn't called in the nested component and only in the root component of the route when the user tries to navigate away.
Expected/desired behavior
The routerCanDeactivate method should be called in the nested component as well so they can prevent navigation if needed
Other information
If there is a different way to achieve this behavior that Im not aware of then this might not be an issue.
The text was updated successfully, but these errors were encountered: