gpt4 book ai didi

javascript - 当字符串位于模板上时,从 angularjs 中的字符串“回显”html

转载 作者:行者123 更新时间:2023-12-03 07:33:24 25 4
gpt4 key购买 nike

我正在使用 ionic 火种卡,每张新卡都应作为对象插入到预定义的数组中,同样:

{文本:“some_text”}

但是,我可能会在字符串中获取 html,并且我希望呈现该 html。 考虑到上面的对象进入预定义的数组, ionic 代码上发生了一些事情,然后我像这样注入(inject)它,我该如何做到这一点?

<div class="card">
{{card.text}}
</div>

最佳答案

使用 ng-bind-html 指令:可能需要导入清理模块

  <div class="card">
<span ng-bind-html="card.text"></span>
</div>

关于javascript - 当字符串位于模板上时,从 angularjs 中的字符串“回显”html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35720876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com