在typeScript angular 2中解码html

Jav*_*rez 5 html ionic2 angular

我从后端得到一个编码html但我无法解码它.

我尝试使用decodeURIComponent和decodeURI.

I got from server='
"<table style="background-color: white;">
    <tbody>
        <tr>
            <td>
                    <div id="voucher">
                        <table>
                            <tr>
                                <td colspan="1" class="normal-left">ID:</td>
                                <td colspan="3" class="normal-left">ce203c7c804c4f258947adf3d63b2d7d</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
    </tbody>
</table>"
' 
Run Code Online (Sandbox Code Playgroud)

// This is my HTML

<ion-content padding>
<ion-list>
  <ion-item>
    <span [innerHtml]="aux"></span>
  </ion-item>
  </ion-list>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

这就是结果

我曾经在jquery中用document.getElementById("aux")解码.innerHTML = $('').html(voucher).text();

但我不知道Angular 2是否有类似的东西.

谢谢

Cel*_*gra 5

也许你需要一些指令,比如[innerHtml].请使用试试这个例子:

 <div [innerHTML]="var_string"></div>
Run Code Online (Sandbox Code Playgroud)

var_string = "<strong>example</strong>";