Angular 2 equivalent of ng-bind-html, $sce.trustAsHTML(), and $compile?

前端 未结 6 927
暖寄归人
暖寄归人 2020-11-30 09:46

In Angular 1.x, we could insert HTML in real-time by using the HTML tag ng-bind-html, combined with the JavaScript call $sce.trustAsHTML(). This go

6条回答
  •  被撕碎了的回忆
    2020-11-30 10:37

    I think all you have to do is set the element you want to have compiled html with the [innerHTML]="yourcomponentscopevar"

提交回复
热议问题