ng2-treelist

Create a tree list component with Angular2

Usage no npm install needed!

<script type="module">
  import ng2Treelist from 'https://cdn.skypack.dev/ng2-treelist';
</script>

README

ng2-treelist

(WIP) Getting comfy publishing Angular2 Components.

If you are interested in an Angular2 tree component, please use n2-tree

install

npm install --save ng2-treelist

use

After installing ng2-treelist. Import the Tree and Tree Model into your component.

import {Tree, TreeModel} from 'ng2-tree/components';


@Component({
    selector: 'app',
    template: `
               <tree [tree]="tree"></tree>
               `
})

export class App {
    public tree: TreeModel[] = [
        new TreeModel("Menu Item 1", [
            new TreeModel("SubMenu Item 1", [
                new TreeModel("SubSubMenu Item 1", []),
                new TreeModel("SubSubMenu Item 2", [])
            ]),
            new TreeModel("SubMenu Item 2", [])
        ]),
        new TreeModel("Menu Item 2", []),
        new TreeModel("Menu Item 3", [
            new TreeModel("SubTreeModel 3", [])
        ])
    ];
}

TreeModel is will include your own tree nodes.

License

MIT © Malek Hakim