import { Component, OnInit } from '@angular/core'; import { RouterService } from '../services/routerService'; import { FooterService } from './footer.service'; @Component({ selector: 'app-footer', templateUrl: './footer.component.html', styleUrls: ['./footer.component.scss'] }) export class FooterComponent implements OnInit { // thumbArr:Array = ['footer_home.png', 'footer_leave.png', 'footer_flexi.png', 'footer_ODFPNR.png', 'footer_attendance.png']; //resetArr:Array = ['footer_home.png', 'footer_leave.png', 'footer_flexi.png', 'footer_ODFPNR.png', 'footer_attendance.png']; basePath:string = 'assets/images/'; previousSelectedItem:string = ''; selectedItemObject:any = { home : false, leave :false, flexi:false, odf:false, attendance:false } constructor(private footerService:FooterService, private routerService:RouterService) { } ngOnInit(): void { } selectedItem(selectedItem:string):void { if(this.previousSelectedItem.length > 0){ this.selectedItemObject[this.previousSelectedItem] = false; } switch(selectedItem){ case 'home': this.selectedItemObject.home = true; break; case 'leave': this.selectedItemObject.leave = true; break; case 'flexi': this.selectedItemObject.flexi = true; break; case 'odf': this.selectedItemObject.odf = true; break; case 'attendance': this.selectedItemObject.attendance = true; break; default: this.selectedItemObject.home = true; } this.footerService.saveSelectedScreen(selectedItem); this.routerService.navigate('dashboard'); this.previousSelectedItem = selectedItem; } }