jsontree.ts 540 B

1234567891011121314151617181920212223
  1. import coreModule from 'app/core/core_module';
  2. import { JsonExplorer } from '../json_explorer/json_explorer';
  3. coreModule.directive('jsonTree', [
  4. function jsonTreeDirective() {
  5. return {
  6. restrict: 'E',
  7. scope: {
  8. object: '=',
  9. startExpanded: '@',
  10. rootName: '@',
  11. },
  12. link: function(scope, elem) {
  13. const jsonExp = new JsonExplorer(scope.object, 3, {
  14. animateOpen: true,
  15. });
  16. const html = jsonExp.render(true);
  17. elem.html(html);
  18. },
  19. };
  20. },
  21. ]);