我的代码是 here .
你能告诉我浏览器返回以下错误信息吗:
ERROR TypeError: this.onChange is not a function
at RichTextEditorComponent.forwardEvent (rich-text-editor.component.ts:39)
at Object.eval [as handleEvent] (RichTextEditorComponent.html:6)
我试图将“this”对象打印到控制台,它只返回“RichTextEditorComponent”对象。
最佳答案
您的 RichTextEditorComponent
内部有问题您声明的地方 onChange
和 onTouched
类型为 function
没有真正为他们分配实际功能。
onChange: (value:any) => {};
onTouched: () => {};
它应该重写如下(使用
=
)onChange = (value:any) => {};
onTouched = () => {};
关于angular - "ERROR TypeError: this.onChange is not a function"的原因是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60437595/