Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSTALLATION
- -----------------------------
- 1.Install from npm
- ****************************************
- npm install --save angular-tree-component
- ****************************************
- 2.Import the CSS
- styles.scss
- *****************************************************************
- @import '~angular-tree-component/dist/angular-tree-component.css';
- *****************************************************************
- 3.Import the module
- app.module.ts:
- *****************************************************
- import { TreeModule } from 'angular-tree-component';
- @NgModule({
- imports: [..., TreeModule],
- ...
- })
- export class AppModule {
- ...
- }
- *****************************************************
- 4.use the tree-root component:
- app.component.ts:
- ****************************************************
- @Component({
- selector: 'app',
- template: '<tree-root [nodes]="nodes"></tree-root>'
- });
- export class App {
- nodes = [
- {
- id: 1,
- name: 'root1',
- children: [
- { id: 2, name: 'child1' },
- { id: 3, name: 'child2' }
- ]
- },
- {
- id: 4,
- name: 'root2',
- children: [
- { id: 5, name: 'child2.1' },
- {
- id: 6,
- name: 'child2.2',
- children: [
- { id: 7, name: 'subsub' }
- ]
- }
- ]
- }
- ];
- ***************************************************************************
Add Comment
Please, Sign In to add comment