在 Angular 11 中开发类似 Reddit 的社交论坛应用,需要动态添加 ngx-quill 富文本编辑器。我研究了文档和现场演示,但没有找到方法,还有一些关于 AngularJS 和原生 quills 的 SO 问题。这是我认为应该添加 ngx-quill 编辑器的内容
<div id="qeLocation1"></div>
<button (click)="addQE()">Add QE</button>
import { Renderer2 } from '@angular/core';
import { QuillModules, QuillService, QuillEditorBase, QuillEditorComponent, QuillModule } from 'ngx-quill';
constructor(r2: Renderer2){}
addQE()
{
/* not sure to use QuillEditorComponent, or others.
if it is, how to specify parameters:
injector, elementRef, domSanitizer, platformId, zone, service
*/
var qe = new QuillEditorComponent(...);
var where = document.getElementById("qeLocation1");
this.renderer.appendChild(where, qe);
}