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
|
|
15
|
constructor(private router: Router) {
|
16
|
}
|
17
|
|
18
|
ngOnInit(): void {
|
19
|
}
|
20
|
|
21
|
private getCurrentRoute(): string {
|
22
|
return this.router.url.split('?')[0];
|
23
|
}
|
24
|
|
25
|
isTheActiveMenu(route: string): boolean {
|
26
|
return this.getCurrentRoute().indexOf(route) !== -1;
|
27
|
}
|
28
|
}
|