angular-tools / ng-jsoneditor Goto Github PK
View Code? Open in Web Editor NEWAngular version of the insanely cool jsoneditor
License: Artistic License 2.0
Angular version of the insanely cool jsoneditor
License: Artistic License 2.0
Set onEditable
to false.
$scope.obj = {
data: json,
options: {
mode: 'tree',
onEditable: function(){return false;}
}
};
Click on the box [ ] to the left of a key and then select insert. Right now, a blank field and value are inserted. Warning signs are displayed without any capabilities to resolve since json is readonly.
Hello there, any chance to get a example to see differences between 2 json files on Angular ? Or at least to have synch between 2 json files under Angular ?
Regards
So, guys how look your plans (month/year) for new release version to Bower? Direct usage of ng-jsoneditor:master as a version for bower a bit danger for our project :)
Thanks!
See example: http://jsfiddle.net/fm3eku9q/
I'm expecting that editor will contain the JSON that was provided as an arg, but instead contains an empty object.
It would be very useful to have an option to suppress errors so that the console does not get cluttered up (example error message below). These errors are thrown while the user is typing and they add up quickly.
Error: Parse error on line 8:
...": true, "test" "Created": "2016-01-
---------------------^
Expecting 'EOF', '}', ':', ',', ']', got 'STRING'
at Object.parse (jsoneditor.js:6586)
at Object.validate (jsoneditor.js:1620)
at Object.parse (jsoneditor.js:1476)
at JSONEditor.textmode.get (jsoneditor.js:1408)
at ng-jsoneditor.js:32
at angular.js:17918
at completeOutstandingRequest (angular.js:5552)
at angular.js:5829
my app logged to console:
Option "change" has been renamed to "onChange" (jsoneditor.min.js:30)
and error:
Cannot read property 'hasOwnProperty' of undefined
image error console log: http://pasteboard.co/kfckayL4W.png
How to fix it?
Thanks!
Hi,
I have a predefined json where user can only update the values of keys. Can I disable editing of the keys in a json
Hey,
I'm using angular-json-editor and ng-jsoneditor in my app, they both are using some json-editor.js file, so I'm facing some conflicting problem and not able to solve issue by my self.
<div name="json"
class="col-md-12"
id="json"
ng-model="json"
options="options"
ng-jsoneditor
style="height: 300px"></div>
$scope.options = {
mode: 'code',
modes: ['code','view'], // allowed modes['code', 'form', 'text', 'tree', 'view']
error: function (err) {
alert(err.toString());
}
};
$scope.json = {
test: 123
};
$timeout(function () {
$scope.json = {
test: 111
};
}, 1000)
Editor always shows empty Object: {}
And don't reflecting to any change
I looking for option to disable editor, user can edit value, only view
This warning is being logged to the console.
JSONEditor allows you to specify a custom ace editor. However, if you do this, then ng-jsoneditor doesn't switch between code and tree mode correctly. For example, if you start in tree mode, and try to switch to code mode, you need to select code mode twice to make the switch. It's pretty clear that code mode is being rendered by JSONEditor, but then is being switched quickly back to tree mode the first time.
I modified the jsfiddle to recreate the issue: http://jsfiddle.net/sd3at5ek/10/
I'm happy to look into it, but thought I'd see if the solution seems clear to you before looking more closely!
I'm getting a bit strange behavior when editing in code view mode. I place the caret and start typing, and the characters appear approx 20 chars before the caret, at a bit random position. When editing a string, the characters can get out of the string, so the json structure is damaged too eventually at a ~random spot. ...
Any ideas what might be causing this?
FF and chrome produce the same behavior for me.
Styling seems not to matter either, ...
jsoneditor 5.9.4
angularjs 1.6.6
I'm trying to track down a weird behavior where typing into the value of a field causes the "tree" mode to collapse and leaves me unable to see the field where I'm typing. Has anyone seen this or does anyone understand what might cause this ? This does not happen in "text" mode.
I'm pretty sure this is related to the "timeout" value in the options. If I set that to say 1000mS then the collapse doesn't occur until after 1000ms.
Could a new version be released to bower? Would be nice to have the latest with the pr for #12 be published.
Maybe v1.1.0?
Do you planning to switch to jsoneditor 5 version?
Now bower.json dependencies links to ~4 version.
Thanks.
Hi,
Please rename it to angularjs since it belongs to angular 1.x.
If possible, please change ng as well, as its recommended to not use ng
Providing an options.error callback does not seem to work. A workaround so far has been to hook error checking onto the ace editor with ng-jsoneditor="editorLoaded"
. But if I switch modes to tree and then back, it's gone since editorLoaded only fires the first time. Any thoughts?
$scope.editorLoaded = function(jsonEditor) {
console.log('[json editor loaded]');
$scope.editor.instance = jsonEditor;
//TODO: we have a problem, this only fires once, so the error handler only gets attached the first time :(
$timeout(function() {
if ($scope.editor.options.mode === 'code') {
_initErrorHandler(jsonEditor);
}
});
};
var _initErrorHandler = function(jsonEditor) {
console.log('======= initializing error handler ===');
jsonEditor.editor.getSession().on('change', function() {
var debounce;
$timeout.cancel(debounce);
debounce = $timeout(function() {
return $scope.$apply(function() {
try {
jsonEditor.get();
console.log('jsonEditor', 'no errors in edited content');
$scope.error = false;
} catch (_error) {
console.log('jsonEditor', 'editor contents not valid json');
$scope.error = _error;
}
});
}, 300);
});
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.