aureliaaurelia-templating

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?


Solution

  • 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.