Angular 羽毛笔编辑器未显示html字符串
我是angular的新手,在我的angular应用程序中使用quill editor,我使用它允许用户编写HTML代码并呈现来自后端的HTML代码,我在单独的div中预览HTML,但不幸的是,quill editor没有在编辑器中呈现任何HTML代码或任何文本。它为空,并且gettingAngular 羽毛笔编辑器未显示html字符串,angular,quill,Angular,Quill,我是angular的新手,在我的angular应用程序中使用quill editor,我使用它允许用户编写HTML代码并呈现来自后端的HTML代码,我在单独的div中预览HTML,但不幸的是,quill editor没有在编辑器中呈现任何HTML代码或任何文本。它为空,并且getting无法将未定义或null转换为console中的object错误。任何形式的帮助都将不胜感激。多谢各位 public aboutOptions={占位符:“输入关于文本…”,模块:false,主题:'snow',
无法将未定义或null转换为console中的object
错误。任何形式的帮助都将不胜感激。多谢各位
public aboutOptions={占位符:“输入关于文本…”,模块:false,主题:'snow',格式:'Text'};
about:string='hello world'
onTxtEditorCreated(纬管){
var toolbar=quill.getModule('toolbar');
toolbar.addHandler('image',this.imageHandlerMain);
this.txtQuill=quill;
this.txtQuill.setContents(this.txtQuill.clipboard.convert(this.about));
}
如果你没有安装
npm install @dimpu/ngx-quill --save
在html中使用
<ngx-quill #editor [modules]="modules" [(ngModel)]="about" ></ngx-quill>
用如下代码替换html字符串
this.about=this.replaceAll(this.about, "<","<")
this.about=this.replaceAll(this.about),“您的演示没有在编辑器中显示hello world
。我希望它显示在编辑器中。更新的答案@PremI我希望整个字符串hello world
不仅显示在编辑器中hello world
。
replaceAll(string, search, replace) {
return string.split(search).join(replace);
}
this.about=this.replaceAll(this.about, "<","<")