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

Re : Testing CanJS Web Apps

$
0
0
When adding a click event on an element in the controller, the click event works but not the route. Am I doing something wrong? or is the framework having problems with AMD and require.js?

  1. define(["can"],function(can){
  2.       var HelloWorldController = can.Control({
  3.                'click':function(el,event){
  4.                        console.log(el, " Clicked"); // this works
  5.                  },
  6.   'route': function() {
  7.           // matches empty hash, #, or #!
  8.           console.log("EMPTY ROUTE"); // Does not work
  9.   },
  10.   'about/:id route': function( data ) { 
  11.           // matches routes like #!todos/5
  12.           console.log("ROUTE", data);// Does not work
  13.             }
  14. });  
  15. return HelloWorldController; 
  16. });

Viewing all articles
Browse latest Browse all 3491

Trending Articles