Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy-load MonacoEditor, which has an AMD loader #421

Open
chengtie opened this issue Apr 25, 2018 · 0 comments
Open

Lazy-load MonacoEditor, which has an AMD loader #421

chengtie opened this issue Apr 25, 2018 · 0 comments

Comments

@chengtie
Copy link

chengtie commented Apr 25, 2018

First, thanks for this super useful tool...

I have a website by AngularJS, which uses MonacoEditor, which seems to have an AMD loader. In my index.html, I have the following code, which displays well monaco:

<link rel="stylesheet" data-name="vs/editor/editor.main" href="/monaco-editor/min/vs/editor/editor.main.css" />
<script src="/monaco-editor/min/vs/loader.js"></script>
<script src="/monaco-editor/min/vs/editor/editor.main.nls.js"></script>
<script src="/monaco-editor/min/vs/editor/editor.main.js"></script>
<script> console.log(monaco) </script>

Now, I want to lazy-load MonacoEditor with ocLazyLoad, But the following code returns monaco is not defined:

.state('addin', {
	    abstract: true,
	    template: '<ui-view/>',
	    resolve: {
		loadAddinCtrl: ['$ocLazyLoad', function ($ocLazyLoad) {
			return $ocLazyLoad.load({files: [
				"/monaco-editor/min/vs/editor/editor.main.css",
				"/monaco-editor/min/vs/loader.js",
				"/monaco-editor/min/vs/editor/editor.main.nls.js",
				"/monaco-editor/min/vs/editor/editor.main.js"
			]}).then(function () {
				console.log(monaco)
			})
		}]
	    }
})

Does anyone know how to fix it?

@chengtie chengtie changed the title Lazy-load MonacoEditor, which has a AMD loader Lazy-load MonacoEditor, which has an AMD loader Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant