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

Re : Basic routing with two properties

$
0
0
ok, but i can listen when property page is a particular value ?

example

i would like make this is :


$(function() {

  Router = can.Control({

      "route": function(){
        console.log("the hash is empty")
      },
      '{can.route} page=search': function(data){
              console.log("the hash is "+data.page+" with id "+data.id )

      },{can.route} page=registration': function(data){
              console.log("the hash is "+data.page)
      }

    });

    can.route(':page/:id');
    can.route.ready();

    new Router(window);

});

and 

> can.route.attr({page: "search", id: "123-jlkj-1231"})

and display in console

the hash is search with id 123-jlkj-1231

I tested, but this doesn't work :)

Do you see what I want to do ?




Viewing all articles
Browse latest Browse all 3491

Trending Articles