Project

General

Profile

1
import {Component, Input, OnInit} from '@angular/core';
2
import {Router} from "@angular/router";
3
import {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
  @Input() name = null;
12

    
13
  constructor(private router: Router) {
14
  }
15

    
16
  ngOnInit(): void {
17
  }
18

    
19
  private getCurrentRoute(): string {
20
    return this.router.url.split('?')[0];
21
  }
22

    
23
  isTheActiveMenu(route: string): boolean {
24
    return this.getCurrentRoute().indexOf(route) !== -1;
25
  }
26
}
(2-2/3)