2

In my Router code, I have the following routes:

   Router = can.Control ( {
     "adminPrograms route" : function ( ) {
        // Load Programs screen...
     }
     , "adminProgramSkus route" : function ( ) {
        // Load Program Skus screen...
     }
   });

I First navigate to the "adminProgramSkus" route. Then I try to navigate to the "adminPrograms" route. The URL gets updated to the properly location but the code to Load the Programs screen does not execute.

I even tried the navigation in reverse, "adminPrograms" to "adminProgramSkus" but the results was the same, the code for the 2nd route was never executed.

Looking for suggestions on how to remedy an Issue dealing with routes that are named similarly.

Thanks

Griz
  • 21
  • 1
  • Which version of CanJS are you using? You might need to do something more like `":page route": function() { .. }` and check the page property within the function. – Justin Meyer Mar 06 '18 at 21:44
  • I am using version version 3.3. I tried using the following: – Griz Mar 13 '18 at 13:25
  • The # (hash) value in the URL gets updated, yet the :page route function never gets executed. – Griz Mar 13 '18 at 15:09
  • Here is the code I tried using: Router = can.Control ( { ":page route" : function ( data ) { console.log{"page::" + data.page); if ( data ) { if ( data && data.page == 'adminProgram') { // Load Program screen... } else if // Load Program Skus screen... } else { // Load Home screen... } } else { // Load Home screen... } } }); – Griz Mar 13 '18 at 15:09
  • did that work? Btw, with a 3.3 app, people tend to setup routing similar to the example shown here: https://canjs.com/doc/guides/technology-overview.html#Routingandtherootcomponent – Justin Meyer Mar 14 '18 at 15:33

0 Answers0