My HTML template has:
<ckeditor #ckeditor [editor]="Editor" [data]="doc.text ? doc.text : ''"
(ready)="evtEditorReady(ckeditor)"></ckeditor>
and in the Angular Component:
evtEditorReady(component: CKEditorComponent) {
console.log('evtEditorReady', component);
if (!component) return;
let editorInstance = component.editorInstance;
console.log('editorInstance', editorInstance);
setTimeout(() => {
editorInstance = component.editorInstance;
console.log('editorInstance Again', editorInstance);
}, 3000);
The first log of the variable is null, but in the setTimeout callback it is set. According to the documentation, the editorInstance is supposed to be available when that event is fired. I think that the problem is related to the ckeditor element is inside an *ngIf structure. There is a warning about that in the documentation, but the remedy was supposed to be to wait for the ready event and not rely on a @ViewChild reference.
Did I read this wrong? Is there another event I could use to get an editorInstance without relying on a timer delay?
The console shows
editorInstance null
editorInstance Again dj {_context: sc, id: 'ec7ea983f3d2b8c30f7c38ff4949b460e', config: Ga, plugins: $a, locale: ic, …}
My HTML template has:
and in the Angular Component:
The first log of the variable is
null, but in the setTimeout callback it is set. According to the documentation, theeditorInstanceis supposed to be available when that event is fired. I think that the problem is related to the ckeditor element is inside an *ngIf structure. There is a warning about that in the documentation, but the remedy was supposed to be to wait for the ready event and not rely on a @ViewChild reference.Did I read this wrong? Is there another event I could use to get an editorInstance without relying on a timer delay?
The console shows