Let's say I have a very simple template :
<script type="text/x-handlebars" data-template-name='myTemplate'>
<h1>{{name}}</h1>
<div>{{content}}</div>
</script>
And a model that will look like that :
model = {
name: 'My name',
content: 'some content <a href="target">with a link</a> and some <i>italic</i> text'
}
I don't make the model, I load it from a web service and it will have (or not) html tags in it.
"My name" is properly rendered, but the content is rendered as a string and not interpreted as html.
How do I force ember to render html in a template
Ok, sorry... By posting the question I realized it could be an handlebars question.
The answer was in handlebars documentation :
Handlebars HTML-escapes values returned by a {{expression}}. If you don't want Handlebars to escape a value, use the "triple-stash", {{{.
So My template has to be :
<script type="text/x-handlebars" data-template-name='myTemplate'>
<h1>{{name}}</h1>
<div>{{{content}}}</div>
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With