Edit: a clarification for anyone who only skimmed the title, my question is about Angular 2, not 1.
I have a component template that is something like this:
<div>{{ post.body }}</div>
该对象类似于:
{
"title": "Some Title",
"body": "<p>The <em>post body</em>.</p>"
}
Instead of rendering the paragraph like:
The post body
它显示:
"<p>The <em>post body</em>.</p>"
由于这是一项非常常见的任务,我寻找了一个内置管道,比如{{ post.body | safe }}
,但没有看到一个.
Is there is an easy way to get that working? Is there a safe way to get that working?