import { Component , Input , OnInit } from '@angular/core' ; import { ContextualMenu } from '../../models/contextual-menu.model' ; import { ActivatedRoute , Router } from "@angular/router" ; @ Component ( { selector : 'app-contextual-menu' , templateUrl : './contextual-menu.component.html' , styleUrls : [ './contextual-menu.component.scss' ] , providers : [ ] } ) export class ContextualMenuComponent implements OnInit { constructor ( private router , private activatedRoute ) { } @ Input ( ) pageTitle : String ; @ Input ( ) currentState : String ; @ Input ( ) listOfMenus : ContextualMenu [ ] ; selectedMenu : ContextualMenu ; lastClickedRoute ; ngOnInit ( ) { } onSelect ( menu ) { this . selectedMenu = menu ; this . lastClickedRoute = menu . route ; this . router . navigate ( [ menu . route ] ) ; } isCurrentUrl ( menuItem ) { let currentUrl = window . location . href ; return ! ! ~ currentUrl . indexOf ( menuItem . route ) ; } }