簡體   English   中英

AngularJS中的Textarea無法呈現HTML

[英]Textarea in AngularJS not rendering HTML

我在Ionic的應用程序中有一個textarea,用於創建新消息或編輯消息。 我的問題是,當我嘗試編輯消息時,textarea不會將String呈現為HTML標記。

我已經嘗試設置ng-bind-html並使用$sce過濾器。

是我嘗試過Plunker。

我不認為可以在textarea中綁定html,但是您可以嘗試“ contenteditable”

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

看看這個plunkr: https ://plnkr.co/edit/WDvKdG ? p = preview

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM