Search code examples
javascriptjqueryhtmlhtml5-historypath.js

Pathjs routing issue


I have this route:

Path.map("/(:page_1)(/:page_2)/").to(funct);

and it is not matching

/projects/index2/

it matches /anything but not /anything/anything

Any ideas?


Solution

  • Try wrapping only the second optional value in parentheses. So, instead of doing:

    Path.map("#/(:page_1)(/:page_2)/").to(funct);
    

    try:

    Path.map("#/:page_1(/:page_2)").to(funct);
    

    Check out this jsfiddle: http://jsfiddle.net/Jkeq9/1/