简体   繁体   English

Angular ngRepeat html内容

[英]Angular ngRepeat html content

I have the following: 我有以下内容:

<div class="columns large-12">
    <p ng-repeat="desc in joinUs.description">{{desc}}</p>
</div>

How can I display html content inside the repeated paragraph? 如何在重复的段落中显示html内容? Basically I want to repeat: 基本上我想重复一遍:

<p ng-bind-html="{{desc}}"></p>

joinUs.description is an array of strings, some containing anchor tags. joinUs.description是一个字符串数组,其中一些包含锚标记。

Edit 编辑

I have tried this the following (as suggested angular.js ng-repeat li items with html content ) but the html is still shown as plain text. 我已经尝试了以下操作(如建议的angular.js ng-repeat li项目以及html内容 ),但html仍显示为纯文本。

<div class="row">
    <div class="columns large-12">
        <p ng-repeat="desc in joinUs.description" ng-bind-html-unsafe="desc">{{desc}}</p>
    </div>
</div>

try this: 尝试这个:

 <p ng-repeat="desc in joinUs.description" ng-bind-html="desc"></p>

plunkr with similar use is here: http://plnkr.co/edit/wiHj5kwdbb08ag8NQcoJ?p=preview 具有类似用法的plunkr在这里: http ://plnkr.co/edit/wiHj5kwdbb08ag8NQcoJ?p=preview

(it might help, if you add a working sample as plunkr/fiddle or similar) (如果您将工作样本添加为plunkr / fiddle或类似名称,则可能会有所帮助)

edit: 编辑:

ng-bind-html-unsafe has been deprecated. ng-bind-html-unsafe已弃用。 see this stackoverflow question: With ng-bind-html-unsafe removed, how do I inject HTML? 看到这个stackoverflow问题: 删除ng-bind-html-unsafe后,如何注入HTML?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM