├── .gitignore ├── LICENSE ├── Readme.md ├── bower.json ├── example.html ├── json-tree.css ├── json-tree.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .directory 3 | *.log -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2014 Konstantin Skipor 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 13 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 14 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 15 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 16 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Editable JSON tree 2 | 3 | [](https://www.npmjs.org/package/json-tree2) 4 | 5 | An AngularJS directive used for displaying and editing JSON data in a tree view. It works independently of jQuery (only internal angular's jqLite). 6 | Available operations with nodes: 7 | 8 | * `add` new nodes, 9 | * `reset` node values to null, 10 | * `remove` node completely, 11 | * `change` node value, 12 | * `convert` type of the node (to object, array, string, number, boolean, null, function) implicitly, 13 | * `drag` and `sort` tree nodes (via pressed `Ctrl`). 14 | 15 | ## How to use 16 | 17 | ### Install 18 | 19 | ##### bower 20 | 21 | $ bower install json-tree 22 | 23 | An AngularJS would be installed as a dependency automatically. If it won't, install it manually: 24 | 25 | $ bower install angular 26 | 27 | Add dependencies to the `
` section of your main html: 28 | ```html 29 | 30 | 31 | 32 | ``` 33 | 34 | If you don't use bower, you can manually download and unpack json-tree ([zip](https://github.com/krispo/json-tree/archive/v0.1.5.zip), [tar.gz](https://github.com/krispo/json-tree/archive/v0.1.5.tar.gz)). 35 | 36 | ##### npm 37 | 38 | $ npm install json-tree2 39 | 40 | ### Basic usage 41 | 42 | Inject `json-tree` directive into angular module and push some data to the controller: 43 | ```javascript 44 | angular.module('myApp', ['json-tree']) 45 | .controller('myCtrl', function('$scope'){ 46 | $scope.jsonData = { /* JSON data */ }; 47 | }) 48 | ``` 49 | 50 | and in html again you can use it like: 51 | ```html 52 |'Ctrl'
key
|
32 |
edit-level="low"
, collapsed-level="3"
)
|
66 |