Back

Router

Define your routes

You can define your routes:

Use the router

<router base="/web"> <routes array=""> <route url="/user/list"> <content tag="userlist"></content> </route> <route url="/user/detail/[userid]"> <content tag="userdetail"> </content> </route> </routes> </router>
  • content
    You can define multiple areas like "content" for you to include.
  • params
    Set the attributes for your tag to include. You can access the current params with router$.params, for example router$.params.userid

Include the router content

Include the router content:

Use the include tag

<include tag="{router$.active ? router$.active.content.tag : 'spinner'}" params="{router$.active.content.params}"> </include>

Link

Just use the link attribute to link to another page (without the base url):

Use the link (with a url)

<div> <a link="/user/{user.id}">{user.getName()}</a> </div>

You can also use the name instead of the URL:

Use the link (with route name)

<div> <a link="home">Home</a> </div>

You can also use the goto function of the router:

Go to the /mysite/subsite page

router$.goto('/mysite/subsite')