简体   繁体   中英

Aurelia: translate + parameter comes from value converter

I use an value converter to format date format:

${date | formatDate}

Next I'd like to use this formatted date as a translator parameter. Something like this way:

${'dateOfCreation' | t: {'date': ${date | formatDate}}}

But it doesn't work. Is it even possible to do that in Aurelia? If not, how should I do that?

Thanks!

Unfortunately, Aurelia currently does not support nested value converters. You can use this as a workaround:

<div ref="myDiv" formatted-date="${date | formatDate}">
  ${'dateOfCreation' | t: { 'date': myDiv.formattedDate } }
</div>

Hope this helps!

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