[英]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. 我在Ionic的应用程序中有一个textarea,用于创建新消息或编辑消息。 My problem is when I try to edit the message, the textarea doesn't render the String as HTML tags.
我的问题是,当我尝试编辑消息时,textarea不会将String呈现为HTML标记。
I've already tried to set ng-bind-html
and use the $sce
filter. 我已经尝试设置
ng-bind-html
并使用$sce
过滤器。
Here's a Plunker with what I've already tried. 这是我尝试过的Plunker。
I don't think it is possible to bind html in a textarea but you can try "contenteditable" 我不认为可以在textarea中绑定html,但是您可以尝试“ 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 看看这个plunkr: https ://plnkr.co/edit/WDvKdG ? p = preview
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.