Guest User

Untitled

a guest
Jul 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. INSTALLATION
  2. -----------------------------
  3.  
  4. 1.Install from npm
  5. ****************************************
  6. npm install --save angular-tree-component
  7. ****************************************
  8.  
  9. 2.Import the CSS
  10. styles.scss
  11. *****************************************************************
  12. @import '~angular-tree-component/dist/angular-tree-component.css';
  13. *****************************************************************
  14.  
  15. 3.Import the module
  16. app.module.ts:
  17. *****************************************************
  18. import { TreeModule } from 'angular-tree-component';
  19.  
  20. @NgModule({
  21. imports: [..., TreeModule],
  22. ...
  23. })
  24. export class AppModule {
  25. ...
  26. }
  27. *****************************************************
  28.  
  29. 4.use the tree-root component:
  30. app.component.ts:
  31. ****************************************************
  32. @Component({
  33. selector: 'app',
  34. template: '<tree-root [nodes]="nodes"></tree-root>'
  35. });
  36.  
  37. export class App {
  38. nodes = [
  39. {
  40. id: 1,
  41. name: 'root1',
  42. children: [
  43. { id: 2, name: 'child1' },
  44. { id: 3, name: 'child2' }
  45. ]
  46. },
  47. {
  48. id: 4,
  49. name: 'root2',
  50. children: [
  51. { id: 5, name: 'child2.1' },
  52. {
  53. id: 6,
  54. name: 'child2.2',
  55. children: [
  56. { id: 7, name: 'subsub' }
  57. ]
  58. }
  59. ]
  60. }
  61. ];
  62. ***************************************************************************
Add Comment
Please, Sign In to add comment