'ngx-editor doesn't clear value
Nxg-editor (docs) can't clear its value on submit.
I have a code like this in the form
tag, but when I click on method using form.reset()
it doesn't clear the value of the editor. In fact, the value in the form
is clear, but not on the DOM structure (it has a <p>
tag with previous content).
How to remove all content from it?
I've tried this.editor.destroy()
and this.editor = new Editor();
but it doesn't help
<ngx-editor-menu
[editor]="editor"
[toolbar]="toolbar">
</ngx-editor-menu>
<ngx-editor
[editor]="editor"
formControlName="answer">
</ngx-editor>
https://stackblitz.com/edit/ngx-editor-eqktlc?file=src/app/app.component.ts
Solution 1:[1]
try this
this.editor.setContent('');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Judik |