gpt4 book ai didi

javascript - 如何在 HTML
 标签中显示包含代码的 AngularJS 变量?

转载 作者:行者123 更新时间:2023-12-01 03:54:42 26 4
gpt4 key购买 nike

关于这个有什么提示吗?我用谷歌搜索了很多,但还没有找到任何东西..

这段代码向我显示了变量名称,而不是我存储在那里的代码:

<pre class="prettyprint">{{::data.template}}</pre>

提前致谢。

最佳答案

在 Angular 1 和 2 中,您应该能够使用 handel 条;

<pre class="prettyprint">{{data.template}}</pre>

您还可以绑定(bind)数据,

Angular 1:

<pre class="prettyprint" ng-bind="data.template"></pre>

Angular 2:

<pre class="prettyprint" [innerText]="data.template"></pre>

您可以在此处找到有关绑定(bind)的更多信息 - https://www.themarketingtechnologist.co/introduction-to-data-binding-in-angular-2-versus-angular-1/

关于javascript - 如何在 HTML <pre> 或 <code> 标签中显示包含代码的 AngularJS 变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42867770/

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