简体   繁体   中英

Textarea in AngularJS not rendering HTML

I have a textarea in my Ionic's App that is used to create a new message, or to edit a message. My problem is when I try to edit the message, the textarea doesn't render the String as HTML tags.

I've already tried to set ng-bind-html and use the $sce filter.

Here's a Plunker with what I've already tried.

I don't think it is possible to bind html in a textarea but you can try "contenteditable"

<div ng-bind-html="text_field.text"
     contenteditable="true" 
     ng-model="text_field.text"
     cols="50"
     rows="10">

Have a look at this plunkr: https://plnkr.co/edit/WDvKdG?p=preview

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