2017-08-01 79 views
2

我有一个angular4应用程序生成ckeditor元素在不同的角度路线。当我转到路由A时,ckedtior成功绑定到包含ckeditor的组件中定义的数据。如果我去路由b,然后回到路由a,那么数据绑定就不再起作用了。如果我看在我看到下面的错误控制台:如何在角度4应用程序中销毁ckeditor?

[Warning] [CKEDITOR] For more information about this error go to http://docs.ckeditor.com/#!/guide/dev_errors-section-editor-destroy-iframe (ckeditor.js, line 21)

当我去链接它说

Location: plugins/wysiwygarea/plugin.js Description: The editor's could not be destroyed correctly because it had been unloaded before the editor was destroyed. Make sure to destroy the editor before detaching it from the DOM. Additional data: None.

我觉得在此基础上想,我想实施的OnDestroy方法,和销毁组件时销毁编辑器。但我不知道如何做到这一点,从链接中不明确。你如何在angular4应用中销毁ckeditor?或者通过其他方式避免这个问题?

+0

摧毁从组件的'ngOnDestroy'生命周期的钩子里的编辑器实例。 [DOCS](https://angular.io/guide/lifecycle-hooks#component-lifecycle-hooks-overview) – cyrix

+0

谢谢,但我的问题是如何销毁编辑器实例?我知道如何实现一个ngOnDestroy生命周期钩子。 – Dan

+1

https://stackoverflow.com/a/3613307/2545680 –

回答

相关问题