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

Using json-editor with angular and require #61

Closed
arvindkhadri opened this issue May 15, 2018 · 3 comments
Closed

Using json-editor with angular and require #61

arvindkhadri opened this issue May 15, 2018 · 3 comments

Comments

@arvindkhadri
Copy link

I have an angular app and want to use json-editor along with it. I am using require.js to load my dependencies, how can I do the same with json-editor? Is it possible to do this?

@mauryashashi
Copy link

mauryashashi commented May 16, 2018

You can use angular directive for embedding editor and in define function first load editor file.

define(
['jsoneditor'], function () {
angular.module('directives').
directive('schemaeditor',
function () {
//embed, initialize editor here
}
)
}
)

@arvindkhadri
Copy link
Author

@mauryashashi Thanks, that was helpful. But I am looking for help with loading the dependencies of json-editor.js, is there a bundled file that I should be using to load json-editor?

@mauryashashi
Copy link

Except css files, you can load all the JS dependencies in define argument. That will make sure that all dependencies would be available before initializing editor in custom directive. You can bundled them in one file but I think it would be not simple to bundle dependencies using require.

define(
['jsoneditor','other files path'], function () {
angular.module('directives').
directive('schemaeditor',
function () {
//embed, initialize editor here
}
)
}
)

@pmk65 pmk65 added the question label Oct 23, 2018
@pmk65 pmk65 closed this as completed Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants