Conditional redirect on an angular dart page

137 Views Asked by At

I have a page (A) in Angular Dart 2 that would be visible based on a condition. If the condition is false, it should redirect to page B

I can implement this logic using router.navigate in onActivate or onInIt or other hooks. However, router.navigate returns a future. Thus all the router and life cycle hooks and any methods referenced in template still get called.

How can I completely bypass page A and get it redirected to page B if the condition is false? canNavigate() and CanDeactivate would work only if the user navigateS to PAGE A via some other page. It won't work if the user bookmarks and directly visits page A

0

There are 0 best solutions below