简体   繁体   中英

Aurelia href.bind is not working

My route:

{ route: 'weather/:woeid', href: '#/weather',  name: 'weatherd', moduleId: 'weatherd', nav: true, title: 'Weather' }

My HTML:

<a href.bind="route: weatherd, params.bind: { woeid: cityId }">

I want to build this url

#/weather/23423

I am having very hard time doing this. There is nothing in their documentation. Anybody please help

You want to use route-href instead of href.bind in this case.

<a route-href="route: weatherd, params.bind: { woeid: cityId }">

You would use href.bind like this:

<a href.bind="'weather/' + cityId" >

This can be found in the "Generating Route URLs" subsection of the Routing section in the cheat sheet here

<a href.bind="route: weatherd, params.bind: { woeid: cityId }">

should be

<a route-href="route: weatherd; params.bind: { woeid: cityId }">

Use route-href, and use a semicolon instead of a comma.

Replace , by ; :

<a route-href="route: weatherd; params.bind: { woeid: cityId }"></a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM