Comments (5)
Hi!
Thanks for reporting this..
Can u please use this link and check if this behaviour happens?
https://stackblitz.com/edit/angular-json-editor?file=src%2Fapp%2Fapp.component.ts
from ang-jsoneditor.
Sure, I forked your example and added the assignment: https://stackblitz.com/edit/angular-json-editor-uodqc5
And just to make sure that we are talking about the same thing:
I am fully aware that it is impossible to automatically do much about the changing data itself: If the bound data changes there may be any number of conflicts that can't be resolved automatically. I do not expect any meaningful cursor position or expansion state if the bound data changes randomly! This is basically the same scenario a text editor is in when it detects that the edited file has changed on disk. And it resolves that by asking the user what to do: "Keep the state from the editor" or "Reload from disk"? Imho this kind of logic is far outside the scope of this neat little wrapper.
But maybe it would be possible to somehow preserve some state like the previous position of the cursor and the selected mode? At least for minor edits this should do the trick.
from ang-jsoneditor.
Gotcha!
My question is.. why you need to change the data? If you need to save this on database, just call the ajax, or if you need that in another component, you can call a event or service to pass it on
Because the problem here is to update the same data you used to build the jsoneditor
from ang-jsoneditor.
I use the editor as a (weak) excuse to postpone some "real" UI writing (screenshot 2 and 3). The edited data models are quite complex, so building their UI simply takes a while. Having some kind of two way databinding allows loads of experimentation: You can change the model from the (only partially finished) UI and from the editor.
As I said: I wouldn't expect the actually edited data to survive or to get merged. But I would love to see "trivial" parts the editor state preserved when changing the data. Currently even if I only "write back" the data selectively (shown in the first screenshot) things like the selected mode are lost.
Screenshot 1: Selective update, asking the user "Data has changed, which version do you prefer?"
Screenshot 2: Hardly any UI at all, only a JSON-editor
Screenshot 3: A little UI, but still a JSON-editor
from ang-jsoneditor.
Thanks!!
I think i got a solution for you, check version 1.6.2.. if is not working as expected please reopen
from ang-jsoneditor.
Related Issues (20)
- Support Angular 15 HOT 3
- TypeError: (jsoneditor__WEBPACK_IMPORTED_MODULE_0___namespace_cache || jsoneditor__WEBPACK_IMPORTED_MODULE_0___namespace_cache) is not a constructor HOT 14
- field value type number gets overriden
- 'NgJsonEditorModule' does not appear to be an NgModule class. HOT 1
- JsonEditorOptions param changing didn't update component
- Upgrade to angular 16 HOT 1
- Bug when editting a json file
- It is impossible to build v3.1.1 with Angular v14, however version 3.1.0 builds fine HOT 1
- How does one set the theme? HOT 1
- svelte-jsoneditor HOT 2
- Main menu, navigation, and status bars are missing by default with latest dependencies
- Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments. HOT 1
- Support for Angular 16 & 17? HOT 3
- Question: How to hide some of the options from option .
- Failure to compile
- Not able to track changes in the editor
- special characters throwing the exception HOT 2
- jsoneditoroptions.ts needs to be synced up with native jsoneditor
- Update dependencies to jsoneditor 10.x.x
- Error: "Self is not defined" from the package library, when used in Angular 17 SSR Prerender
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ang-jsoneditor.