小编Jav*_*rez的帖子

在typeScript angular 2中解码html

我从后端得到一个编码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是否有类似的东西.

谢谢

html ionic2 angular

5
推荐指数
1
解决办法
6334
查看次数

标签 统计

angular ×1

html ×1

ionic2 ×1