2017-08-01 45 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 –

回答

相關問題