Interpolation fails on inline string containing HTML
See original GitHub issueAs demonstrated in this fiddle, the following is interpreted literally:
<p>{{{ '<strong>hello</strong> world' }}}</p>
Instead, I would expect it to produce:
<p><strong>hello</strong> world</p>
This also occurs with normal interpolation ({{ }}
).
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
interpolate variables in strings in JavaScript not working when ...
I want to interpolate the words_to_be_removed variable with the defaultMessageTest string. I have tried the below 3 methods but none of them ...
Read more >string interpolation - format string output - Microsoft Learn
When an interpolated string is resolved to a result string, items with interpolation expressions are replaced by the string representations ...
Read more >String Interpolation in JavaScript - Dmitri Pavlutin
In JavaScript, the template string implements the string interpolation. A template string is defined by wrapping a sequence of characters into ...
Read more >Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >Displaying values with interpolation - Angular
Interpolation refers to embedding expressions into marked up text. By default, interpolation uses the double curly braces {{ and }} as delimiters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi
I am not entirely convinced this should be considered a bug. According to the docs: The mustache tag will be replaced with the value of the msg property on the corresponding data object. In your example there is no data object.
To be able to get an error message I modified your example from
to
as the docs state the triple curly braces will ultimately be compiled as v-html directive. Then you can see in the console the following warning:
What is happening here is vue is looking for the properties on the data object but cannot find them because they are not there. Here is a working example: https://jsfiddle.net/bsyxkxy2/
Closing 1.x issues as 1.x is now end of life and will only receive critical security patches.