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

Re : Testing CanJS Web Apps

$
0
0
Thank you very much sir. I did look threw the well documented API for CanJS. 
There is a weird problem occurring when declaring a new controller with routing capabilities via the AMD library of CanJS.
When declaring a new controller using the normal non AMD, the routing works fine just like the example provided by you guys via your well documented API online. But when doing so using your AMD version, the routing does not work at all. This code is similar to the code provided above but with updated program instructions. 

  1. // The controller with simple route(s)
  2. define(["can"],function(can){
  3. var HelloWorldController = can.Control({
  4.   'route': function() {
  5.     // matches empty hash, #, or #!
  6.     console.log("EMPTY ROUTE");
  7.   },
  8.   'todo/:id route': function( data ) { 
  9.     // matches routes like #!todos/5
  10.     console.log("ROUTE", data);
  11.     }
  12. }); 
  13. return HelloWorldController; 
  14. });


  15. // Main.js
  16. require(["controllers/HelloWorldController"],function(HelloWorldController){
  17.     new HelloWorldController("#contentWrapper");    
  18. }); 

The routing does not work at all when using AMD. 

Thanks again.

Viewing all articles
Browse latest Browse all 3491

Trending Articles