Hi my requirement is to make a function that format the JavaScript code, currently using "ngx-monaco-editor-v2" because its support angular 17, issue here is there is not inbuild method for format the code till today, as for monaco-editor its there but not in "ngx-monaco-editor-v2",i checked all the sources available can't find.
Searched all the sources available in internet can't get enough information possibly very new released.
Hi I found the solution to format the code below are my steps, please do follow,
1- There is no inbuild method in "ngx-monaco-editor-v2", so need to do from outside the editor.
2- I found "js-beautify" npm which worked for me also try "npm i --save-dev @types/js-beautify" simply "npm i js-beautify" will throw error.
3- Here is my function to format the code:-
//ts
// html
Hope you have got the answer.