atularen/ngx-monaco-editor

Doubts about monaco.editor.create

matheusnicolas opened this issue · 2 comments

Hey guys, I'm trying to use monaco.editor.create and I'm facing this error:

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')

how could I do this if I'm using ngx-monaco-editor and I want to configure my monaco-config.ts:

let editor = monaco.editor.create(document.getElementById('container'), { theme: 'my-theme', language: "my-language" });

My html angular code:

`


<ngx-monaco-editor class="editor custom--monaco-editor" *ngIf="!loading" [options]="editorOptions" [(ngModel)]="data.code">

`

I tried to use window.onload, addEventListener but nothing works, I don't know how could I try to solve this problem. I suspect it's something because I already have the ngx component in the html, but I might be wrong.

I got it working, no worries!

@matheusnicolas what'd you change?