Routing Problems with canDeactivate

Hey Community.

You can use canDeactivate to check whether navigation is allowed. But the problem is that the destination path is already in the browser location. If canDeactivate returns false, the navigation goes back again. Is it possible to somehow prevent the behavior that the path is already set, or is there perhaps another hook.

In the image “produktliste” is the destination where it is not allowed to navigate to. When canDeactivate is exited, the path changes again.

image

Hi @Marcel-B, can you please provide a repro?

Hello Sayan.

Just take the navigation app with au new. On the Welcome page I write false at canDeactivate return and set a breakpoint. When the application breaks there the target is visible in the browser (in my example the Github Users). If the Aurelia application runs as a SystemJs module in a spa container the behavior causes problems.