Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : CanJS - Default route called when route is not default

$
0
0
Hi

Ok, thx for giving it a shot. But I still don't get why my default route listener is called (including the :project listener) when I change the route the first time. I have updated my pen with the current route value.

Initially the default route is set to !#0. 
Clicking 'Change route' changes the route to #!1 and both listeners are called (strange...) 
Clicking 'Change route' again changes the route to #!2 and only the ':project' listener is called (as expected). 
Clicking 'Default route' resets the route to #!0 and the ':project' listener is called (as expected? Or should the default listener be called instead since the route is now at default?). 
At this point when clicking 'Change route' only the ':project' listener is called. It changes from #!0 to #!1 like it does the first time only now only the ':project' listener is called (as expected). 

So the big question is why does it call both listeners the first time? 

Note: Your pen is not working since the url to can.jquery.min is not available. You can use the cdn version http://cdnjs.cloudflare.com/ajax/libs/can.js/1.1.3/can.jquery.min.js

Viewing all articles
Browse latest Browse all 3491

Trending Articles