简体   繁体   中英

Aurelia template parse error when string contains HTML entity for quote character

When I try to feed a string to Aurelia from a template and the string contains HTML entities representing the same quoting character as those surrounding the string, I get parser errors. Apparently the HTML enitities are interpreted before they reach Aurelia, but I'm not sure shy.

For example:

${"Why wouldn't "this" work?"}

Results in

Error: Parser Error: Unconsumed token this at column 15 in expression ["Why wouldn't "this" work?"]

Could somebody tell me why entities are interpreted rather than just outputted to the DOM? And what can I do to get this to work?

it seems aurelia parser interprets &quot like equivalent to ". This makes your expression look incorrect to the parser. You should escape the " quotes like this:

${"Why wouldn't \"this\" work?"}

Regards.

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