Links in Aurelia

Creating links in Aurelia is really easy:

<a route-href="route: dashboard">Dashboard</a>

This generates something like: http://localhost:8080/dashboard

By using route-href we can easily map the url to a router path in the router configuration.

But what if we want to pass some extra parameters? To generate something like: http://localhost:8080/dashboard?id=49

<a route-href="route: dashboard; params.bind:{id:49};">Dashboard</a>

And if we want to get something like: http://localhost:8080/dashboard/49

<a route-href="route:dashboard; params.bind:{id:49}; {options: absolute}">Dashboard</a>

How about doing redirections? Also easy:

    { id: 10}


    { id: },
    { absolute: true } // absolute urls

Simple and easy :)

Share Comments
comments powered by Disqus