Project

General

Profile

1
import {Component, Input, OnInit} from '@angular/core';
2
import {Router} from "@angular/router";
3
import {Header, Item} from "../../../utils/entities/sidebar";
4

    
5
@Component({
6
  selector: 'dashboard-sidebar',
7
  templateUrl: 'sideBar.component.html'
8
})
9
export class SideBarComponent implements OnInit {
10
  @Input() items: Item[] = [];
11
  // TODO remove it
12
  @Input() name = null;
13
  @Input() header: Header = null;
14
  @Input() showHeader: boolean = true;
15

    
16
  constructor(private router: Router) {
17
  }
18

    
19
  ngOnInit(): void {
20
  }
21

    
22
  private getCurrentRoute(): string {
23
    return this.router.url.split('?')[0];
24
  }
25

    
26
  isTheActiveMenu(route: string): boolean {
27
    return this.getCurrentRoute().indexOf(route) !== -1;
28
  }
29
}
(3-3/4)