{"id":15184669,"url":"https://github.com/leovo2708/ng2-dropdown-treeview","last_synced_at":"2025-10-01T23:30:45.068Z","repository":{"id":65424517,"uuid":"76936310","full_name":"leovo2708/ng2-dropdown-treeview","owner":"leovo2708","description":"An Angular 2 tree component with checkbox and multiple level","archived":true,"fork":false,"pushed_at":"2019-10-21T22:03:56.000Z","size":79,"stargazers_count":29,"open_issues_count":6,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-15T17:33:05.438Z","etag":null,"topics":["angular","angular-2","angular2","checkbox","component","dropdown","tree","treeview"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leovo2708.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-20T08:03:20.000Z","updated_at":"2023-02-22T02:35:28.000Z","dependencies_parsed_at":"2023-01-23T10:55:18.336Z","dependency_job_id":null,"html_url":"https://github.com/leovo2708/ng2-dropdown-treeview","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leovo2708%2Fng2-dropdown-treeview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leovo2708%2Fng2-dropdown-treeview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leovo2708%2Fng2-dropdown-treeview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leovo2708%2Fng2-dropdown-treeview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leovo2708","download_url":"https://codeload.github.com/leovo2708/ng2-dropdown-treeview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234909086,"owners_count":18905504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-2","angular2","checkbox","component","dropdown","tree","treeview"],"created_at":"2024-09-27T17:21:40.105Z","updated_at":"2025-10-01T23:30:44.666Z","avatar_url":"https://github.com/leovo2708.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ng2-dropdown-treeview [![Build Status](https://travis-ci.org/leovo2708/ng2-dropdown-treeview.svg?branch=master)](https://travis-ci.org/leovo2708/ng2-dropdown-treeview) [![npm version](https://img.shields.io/npm/v/ng2-dropdown-treeview.svg)](https://www.npmjs.com/package/ng2-dropdown-treeview)\n\nAn Angular 2 tree component with checkbox and multiple level.\n\n\u003e This component is discontinued anymore. It's compatible with both Angular 2 \u0026 4.  \n\u003e **But if you are using Angular 4, should switch to my new component [ngx-treeview](https://www.npmjs.com/package/ngx-treeview)**\n\n\u003cbr/\u003e\n\n## Dependencies\n\n* [Angular 2](https://angular.io)\n* [Lodash](https://lodash.com)\n* [Bootstrap 4 alpha 6](https://v4-alpha.getbootstrap.com)\n* [Font Awesome 4](http://fontawesome.io)\n\nYou can customize CSS yourself to break down dependencies to Bootstrap \u0026 Font Awesome.\n\n## Features\n\n* Unlimited tree levels\n* Item state: checked, disabled\n* Collapse / Expand\n* Text filtering\n* Internationalization (i18n) support\n* Template\n\n## Demo\n\nhttps://embed.plnkr.co/1kcbUvNze8HAJ0tN0wsX/\n\n## Installation\n\nAfter install the above dependencies, install `ng2-dropdown-treeview` via:\n```shell\nnpm install --save ng2-dropdown-treeview\n```\nOnce installed you need to import our main module in your application module:\n```js\nimport {DropdownTreeviewModule} from 'ng2-dropdown-treeview';\n\n@NgModule({\n  declarations: [AppComponent, ...],\n  imports: [DropdownTreeviewModule.forRoot(), ...],  \n  bootstrap: [AppComponent]\n})\nexport class AppModule {\n}\n```\n\n## Usage\n\n#### Treeview dropdown:\n```html\n\u003cleo-dropdown-treeview\n    [config]=\"config\"\n    [items]=\"items\"\n    (selectedChange)=\"onSelectedChange($event)\"\u003e\n\u003c/leo-dropdown-treeview\u003e\n```\n\n#### Treeview without dropdown:\n```html\n\u003cleo-treeview\n    [config]=\"config\"\n    [items]=\"items\"\n    (selectedChange)=\"onSelectedChange($event)\"\u003e\n\u003c/leo-treeview\u003e\n```\n\n `config` is optional. This is the default configuration:\n ```js\n {\n    isShowAllCheckBox: true,\n    isShowFilter: false,\n    isShowCollapseExpand: false,\n    maxHeight: 500\n}\n```\nYou can change default configuration easily because TreeviewConfig is injectable.\n\n#### Pipe `leoTreeview`:\nTo map your JSON objects to TreeItem objects.\n```html\n\u003cleo-dropdown-treeview\n    [config]=\"config\"\n    [items]=\"items | leoTreeview:'textField'\"\n    (selectedChange)=\"onSelectedChange($event)\"\u003e\n\u003c/leo-dropdown-treeview\u003e\n```\n\n#### Create a TreeviewItem:\n ```js\n const itCategory = new TreeviewItem({\n    text: 'IT', value: 9, children: [\n        {\n            text: 'Programming', value: 91, children: [{\n                text: 'Frontend', value: 911, children: [\n                    { text: 'Angular 1', value: 9111 },\n                    { text: 'Angular 2', value: 9112 },\n                    { text: 'ReactJS', value: 9113 }\n                ]\n            }, {\n                text: 'Backend', value: 912, children: [\n                    { text: 'C#', value: 9121 },\n                    { text: 'Java', value: 9122 },\n                    { text: 'Python', value: 9123, checked: false }\n                ]\n            }]\n        },\n        {\n            text: 'Networking', value: 92, children: [\n                { text: 'Internet', value: 921 },\n                { text: 'Security', value: 922 }\n            ]\n        }\n    ]\n});\n```\n\nYou can pass the second paramater 'autoCorrectChecked' with value=true (default is false) in constructor of TreeviewItem to correct checked value of it and all of its descendants. In some cases, you need to push or pop children flexibly, checked of parent may be not correct. Then you need to call function correctChecked() to help to correct from root to its descendants.\n ```js\nconst vegetableCategory = new TreeviewItem({\n    text: 'Vegetable', value: 2, children: [\n        { text: 'Salad', value: 21 },\n        { text: 'Potato', value: 22 }\n    ]\n});\nvegetableCategory.children.push(new TreeviewItem({ text: 'Mushroom', value: 23, checked: false }));\nvegetableCategory.correctChecked(); // need this to make 'Vegetable' node to change checked value from true to false\n ```\n\n#### TreeviewEventParser:\nExtract data from list of checked TreeviewItem and send it in parameter of event selectedChange. Some built-in TreeviewEventParser:\n* DefaultTreeviewEventParser: return values of checked items.\n* DownlineTreeviewEventParser: return list of checked items in orginal order with their ancestors.\n* OrderDownlineTreeviewEventParser: return list of checked items in checked order with their ancestors. Note that: value of a leaf must be different from value of other leaves.\n\n#### TreeviewItem Template:\nSee example 4.\n\n## Contributing\n\nI am very appreciate for your ideas, proposals and found bugs which you can leave in github issues. Thanks in advance!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleovo2708%2Fng2-dropdown-treeview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleovo2708%2Fng2-dropdown-treeview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleovo2708%2Fng2-dropdown-treeview/lists"}