简体   繁体   中英

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? Basically I want to repeat:

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

joinUs.description is an array of strings, some containing anchor tags.

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.

<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

(it might help, if you add a working sample as plunkr/fiddle or similar)

edit:

ng-bind-html-unsafe has been deprecated. see this stackoverflow question: With ng-bind-html-unsafe removed, how do I inject HTML?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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