materiahq / ngx-monaco-editor

Monaco Editor Library for Angular v6 and above
MIT License
159 stars 35 forks source link

Is there a way to change editor syntax language dynamically? #23

Closed Pryanishnik closed 4 years ago

Pryanishnik commented 4 years ago

Is there a way to change editor syntax language dynamically? I tried approach as is used for themes, but it doesn't work

jmarc-roy commented 4 years ago

Hi @Pryanishnik,

As you suspect, It is the same approach as for Theme changing. The library components uses OnPush change detection strategy, so you have to provide a new reference of the options object to change the language.

Here is a working example on Stackblitz.

Pryanishnik commented 4 years ago

Oh, thank you @GeoAstronaute . I missed assignment part I suppose, big thanks for Stackblitz:)