monitor-dashboard/src/app/library/sidebar/sideBar.component.ts

27 lines
606 B
TypeScript

import {Component, Input, OnInit} from '@angular/core';
import {Router} from "@angular/router";
import {Item} from "../../utils/entities/sidebar";
@Component({
selector: 'dashboard-sidebar',
templateUrl: 'sideBar.component.html'
})
export class SideBarComponent implements OnInit {
@Input() items: Item[] = [];
@Input() name = null;
constructor(private router: Router) {
}
ngOnInit(): void {
}
private getCurrentRoute(): string {
return this.router.url.split('?')[0];
}
isTheActiveMenu(route: string): boolean {
return this.getCurrentRoute().indexOf(route) !== -1;
}
}