ModelService: Cannot add model because it already exists

See original GitHub issue
ERROR Error: Uncaught (in promise): Error: ModelService: Cannot add model because it already exists!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

12reactions
ajaybabumcommented, Aug 10, 2018

@CoderPoet Write URI as Unique names then it will fix ngx-monaco editor can t add modal error

2reactions
xocoatzincommented, Jun 29, 2018

I found the same error.

I create an editor in one of my components, when navigate away and come back, I see this in the console.

export class SomeComponent implements OnInit { 
  editorOptions = {
    theme: 'vs', 
    language: 'json',
  }; 

  model: NgxEditorModel = {
    value: '{}',
    language: 'json',
    uri: 'foo.json'
  };

And in my template:

<ngx-monaco-editor [options]="editorOptions" [model]="model"></ngx-monaco-editor>

As mentioned by @viccsjain, I’m not currently disposing of the model. Unfortunately I was not able to find the right way to do it in the documentation. What would it be the correct way of doing it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to clear existing models, or is there a way to re-Init ...
Whenever you create a new model, use a try-catch, and if the model already exists, just switch to the corresponding tab (so opening...
Read more >
ModelService: Cannot add model because it already exists
ERROR Error: Uncaught (in promise): Error: ModelService: Cannot add model because it already exists! See More. View in GitHub. SOLVE ISSUE.
Read more >
Support `monaco-editor` in Jest (#119194) · Issues - GitLab
Test suite failed to run Cannot find module 'monaco-editor' from ... Error: ModelService: Cannot add model because it already exists!
Read more >
ModelService (hybris Commerce Suite 1905) - SAP Help Portal
Attaches a model instance to the current model context. This is necessary for all models being created manually using their constructors.
Read more >
Troubleshooting the Modeling Service - MicroStrategy
logs\ModelService.log: The process cannot access the file because it is ... in command line while the Modeling service is already started from Services....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found