Angular with typescript: How to display Html Raw?

时间:2016-10-20 18:48:22

标签: html angularjs typescript

enter image description here

Help me display data with angular 2. Im used [innerHtml] but display like image

<div id="decode-html" [innerHTML]="Detail">

</div>

My string Detail

&lt;p&gt;Tập 7 &amp;quot;Bước nhảy ng&amp;agrave;n c&amp;acirc;n&amp;quot; sẽ l&amp;ecirc;n s&amp;oacute;ng VTV3 v&amp;agrave;o l&amp;uacute;c 21h15 Chủ nhật 16/10/2016.&lt;/p&gt;

Thanks for the help!

1 个答案:

答案 0 :(得分:0)

You can't specify innerHTML from HTML. .innerHTML is a JavaScript property. You need HTML:

<div id="decode-html">

</div>

Then you need JavaScript:

var detail="the string you want to insert";
document.getElementById("decode-html").innerHTML=detail;

If you're trying to use typescript in Angular and you don't yet know HTML, you've got a loooong way to go...