This project was generated with Angular CLI version 10.1.6.
npm i @rzdesign/ngx-category-selector
Import NgxCategorySelectorModule
in your module.
import {NgxCategorySelectorModule} from '@rzdesign/ngx-category-selector';
<lib-ngx-category-selector [data]="categoryData"
(selection)="onCategorySelect($event)"></lib-ngx-category-selector>
categoryData: CategoryNode[] = [
{
id: 1, name: 'Fruits', children: [
{
id: 3, name: 'Tropical', children: [
{
id: 9, name: 'Subtropical', children: []
}
]
},
{id: 4, name: 'Melons', children: []},
{id: 5, name: 'Berries', children: []},
{id: 6, name: 'Citrus', children: []}
]
},
{
id: 2, name: 'Vegetables', children: [
{id: 7, name: 'Leaves', children: []},
{id: 8, name: 'Root', children: []},
]
},
];
Input | Type | Required | Description |
---|---|---|---|
data | CategoryNode[ ] | YES | Array of CategoryNodes |
select | CategoryNode | optional | Preselects a category |
Output | Type | Required | Description |
---|---|---|---|
selection | CategoryNode | YES | Emits the selected category node |
- add unit tests
- implement ControlValueAccessor's
setDisabledState
=> add ability to disable the control, add styling according to form state - implement ControlValueAccessor => add ability to use the component as a form control
Check examples by running the app.
- clone repo
git clone https://github.com/zr87/ngx-category-selector
- cd to repo folder and install dependencies
npm install
- start application:
ng serve
Examples are under src/app/app.component.ts
The package is completely free (MIT license) to use, however the package is licensed as Postcardware. This means that if it makes it to your production environment, we would very much appreciate receiving a postcard from your hometown.
RZdesign, Becsi way 225 8/45, 1032 Budapest, Hungary