root

  • property

{String}

 

Configure the base url that will not be modified.

String

Represents the base url that pushstate will prepend to all routes. root defaults to: "/".

Use

By default, a route like:

can.route(":type/:id")

Matches urls like:

http://domain.com/contact/5

But sometimes, you only want to match pages within a certain directory. For example, an application that is a filemanager. You might want to specify root and routes like:

can.route.pushstate.root = "/filemanager/"
can.route("file-:fileId");
can.route("folder-:fileId")

Which matches urls like:

http://domain.com/filemanager/file-34234