我在以下代码中使用 ng-bind-html:
<a href="/test">
<article>
<p>
Some content goes here
</p>
</article>
</a>
我这样做是为了让整个内容区域成为一个大锚。但是,当使用 ng-bind-html 时,我得到以下输出:
<!-- my anchor tag is closed and stripped! -->
<a></a>
<p>
Some content goes here
</p>
当使用 $sce.trustAsHtml 显式转义输出时:
<!-- anchor tag closed -->
<a href="/test"></a>
<article>
<!-- random anchor added to the top of every nested element -->
<a href="/test"></a>
<p>
Some content goes here
</p>
</article>