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

Basic routing with can.Control

$
0
0
I am new on canjs and i would like use this tuto http://bitovi.com/blog/2012/05/hashchange-routing-can-route-1.html, but doesn't work for me 

    $(function() {
    
    Router = can.Control({
    
      "completed route" : function(){
        console.log("the hash is #!completed")
      },
      "active route" : function(){
        console.log("the hash is #!active")
      },
      "project/create" : function(){
        console.log("the hash is #!project/create")
      },
      "route" : function(){
        console.log("empty hash")
      }
    });

    // make sure to initialize the Control
    new Router(document);

    });


i use window.location.hash = "!#completed" or <a href="#!active">Show Active</a>
no message is displayed in console.

I use canjs 2.0.4 with JQuery

Thank for help 


Viewing all articles
Browse latest Browse all 3491

Trending Articles