Closed kkasaei closed 2 years ago
This is outside the current scope of the project, though if someone would like to submit a PR for this, I would be happy to accept it.
Maybe it would be based on a plugin system? I don't know if I'd like to incorporate XPath generation directly into this directive.
Hello, I had a requirement for my application, to return a JSONPath for user selection in the tree, so I took a shot at it. However, I am not very confident this is the cleanest approach. The changes allow for a use of ng-model with the html template that would hold the JSONPath for the node selected. This only works one-way, i.e. setting the ng-model will not expand the tree to matching node.
@awendland Please advise if any improvements can be made.
Usage:
<json-tree root-name="Data" start-expanded="true" object="someObject" ng-model="jsonPath"></json-tree>
in controller - $scope.jsonPath will have the model value
hi, I'm looking forward to find a way to generate the Xpath of each Node as an attribute in this Directive. can you please help me with this:
var data = { something: { "array": [ 1, 2, 3 ], "boolean": true, "null": null, "number": 123, "object": { "a": "b", "c": "d", "e": "f" }, "string": "Hello World" } };
var desiredPath = "something.object.a" //-> only keys matter.
and where can i use it as an attribute? on ul.branch-value or span.leaf-value?
thanks, regards,