I downloaded Durandal 2.0.1 StarterKit and I am using it for a web project. I worked with it for a while now.
In one of my viewmodels I am using the routing with id in the url: route: 'test/:id'
. Since I want to protect against random id inputs from the user, I am using the canAvtivate
function, in which I perform some checks.
When I'm trying to access the route from another route the canActivate
function is evaluated before activating, but when i just change the id value in the url the function is not called. It happens the same if I say router.navigate("#/test/44");
from within that view.
Is this desired behavior?
This is a bit of a guess as I haven't played much with parameterized routing yet, but perhaps the active module is being reused? Does the section "Module Reuse" at the link below apply in your situation?
http://durandaljs.com/documentation/Using-The-Router/
Perhaps you can work around this by implementing
canReuseForRoute