Enable html template usage with the directive
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[x] feature request
Current behavior
a html template like : "EXAMPLE": "<p>This is an example !</p><p>Look at this !</p>"
won’t be rendered as html if used with the directive.
This :
<div template>EXAMPLE</div>
Now render like this for the user :
<p>This is an example !</p><p>Look at this !</p> (plain text)
Expected/desired behavior Make html renderable by the directive.
This :
"EXAMPLE": "<p>This is an example !</p><p>Look at this !</p>"
<div template>EXAMPLE</div>
Would render like this for the user :
This is an example !
Look at this !
Please tell us about your environment:
- **ng2-translate version:**4.2.0
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
HTML Template Directives - Salesforce Developers
A directive is a special attribute that adds dynamic behavior to an HTML template. You can use certain directives on a root <template>...
Read more >3.10 Using Template Directives
Use template directives to control how attributes that support substitution strings are processed.
Read more >Built-in directives
If you have a static HTML <template> that you need to include in your Lit template, you can use the templateContent directive to...
Read more >The Content Template element - HTML - MDN Web Docs
The <template> HTML element is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded but...
Read more >Template Directives Reference
A template directive could enable some compiler feature that makes your life ... You can also use set:html on a <Fragment> to avoid...
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
In some cases it may be necessary to sanitize the html content before it’s added to the DOM. This may be the case if the interpolation variables contain user-created content or if the translation string itself can be edited by outsiders, e.g., external translators.
Here’s a directive that sanitizes the html
to be used exactly the same way as
innerHTML
:create a setter on the input() and run the changes from there