Tree-ngx

https://github.com/inspirsea/tree-ngx





Introduction

Tree-ngx is designed to be usable "out of the box", aswell as beeing highly customizable. Tested in angular 4 and 5, and in Chrome, FF, Opera, Edge.

Demo

Installation

    
      npm install tree-ngx --save
    
  
Import the scss
    
      @import '~tree-ngx/style/ngx-tree.scss';
    
  

Basic example

    
      
  //Import tree-ngx module
  import { TreeNgxModule } from 'tree-ngx';

  @NgModule({
    imports: [TreeNgxModule]
  }

  //Usage
  <tree-ngx [nodeItems]="nodeItems"> </tree-ngx>

  this.nodeItems = [{
    id: '0',
    name: 'Heros',
    children: [
      {
        id: '1',
        name: 'Batman',
        item: {
          phrase: 'I am the batman'
        }
      },
      {
        id: '2',
        name: 'Superman',
        item: {
          phrase: 'Man of steel'
        }
      }
    ]
  },
  {
    id: '3',
    name: 'Villains',
    children: [
      {
        id: '4',
        name: 'Joker',
        item: {
          phrase: 'Why so serius'
        }
      },
      {
        id: '5',
        name: 'Lex luthor',
        item: {
          phrase: 'I am the villain of this story'
        }
      }
    ]
  }];

    
  
Heros
Batman
Superman
Villains
Joker
Lex luthor