Giter Site home page Giter Site logo

Comments (12)

mariohmol avatar mariohmol commented on June 20, 2024

Hi.. can u describe more this issue?

the demo is working with 2 json editors with no issues

https://stackblitz.com/edit/ang-jsoneditor

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

if u still have this issue... let us know

from ang-jsoneditor.

osmanraifgunes avatar osmanraifgunes commented on June 20, 2024

I have the same problem. If the there is multiple editors (created by ng-for loop) the events are not firing correctly.

Always first editors parameters are passed to bound function of the event.

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

please provide an stackblitz code or something to test this behavuour?

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

Hi.. @osmanraifgunes with the #58 fixes this issue? can u make a demo with this behaviour so we can fix that?
thanks!

from ang-jsoneditor.

osmanraifgunes avatar osmanraifgunes commented on June 20, 2024

Here is the example : https://stackblitz.com/edit/ang-jsoneditor-easjts?file=src/app/app.component.html

Both editors trigger event, but the data is always the first one's data. I think problem is the ang-jsoneditor module works as singleton.

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

thanks for that info!!

what u mean about working as singleton?

do u have any ideas how to fix this?

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

The thing here is about reusing the same editorOptions..

in you case what i did to fix was:

<json-editor [options]="makeOptions()" [data]="prd" (change)="showJson($event)"></json-editor>
  makeOptions = () => {
    return new JsonEditorOptions();
  }

from ang-jsoneditor.

osmanraifgunes avatar osmanraifgunes commented on June 20, 2024

I think solution is using @ViewChildren instead of @ViewChild. I asked this on stackof : https://stackoverflow.com/questions/60040466/angular-component-multiple-instance-binding-input-problem

But doing so is writing this module whole again.

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

I included this solution in the docs and in the demo app as well.. see if that works in your side

from ang-jsoneditor.

SahilMahadwar avatar SahilMahadwar commented on June 20, 2024

Hi how can we add options when we use
makeOptions = () => {
return new JsonEditorOptions();
}

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 20, 2024

Hi you can add this way.

Just updated the docs with it

makeOptions = () => {
  const options = new JsonEditorOptions();
  options.modes = ['code', 'text', 'tree', 'view'];
  return options;
}

from ang-jsoneditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.