microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.28k stars 29.31k forks source link

Uncaught ReferenceError: monaco is not defined (Integrating Editor) #10415

Closed itskhurrams closed 8 years ago

itskhurrams commented 8 years ago

Hello, I am facing this issue while i am integration Monaco Editor in my application. I managed to run the simple sample successfully of editor. but when i moved it to my application. Addling loader link in index.html and Div in my template and

" require.config({ paths: { 'vs': 'node_modules/monaco-editor/dev/vs' } }); require(['vs/editor/editor.main'], function () { var editor = monaco.editor.create(document.getElementById('EditorIDE'), { value: [ 'function x() {', '\tconsole.log("Hello world!");', '}' ].join('\n'), language: 'javascript' }); });" in my controller i am getting error "monaco is not defined" Please help.

alexdima commented 8 years ago

Do you get any errors on the console or in the network tab before this code fails?

Do you have a stack trace? (monaco is used in other places, including inside editor.main.js)

itskhurrams commented 8 years ago

managed to resolve it.

JamesBlack001 commented 8 years ago

So how did you resolve this?

itskhurrams commented 7 years ago

Hi, Please make sure followings. 1- Add the loader link in the body instead of header tag. better in the bottom of the body. 2- Put the initialization function in some scope function and call it on init in the template. 3- make sure the paths are correct.