Angular Router Change Event with Router
First import the router on top - import { ActivatedRoute, Router } from '@angular/router';
Functions
Constructor
constructor(
private localStorageService: LocalStorageService,
private router: ActivatedRoute,
private route: Router,
){
this.getActivites();
}
getActivites(){
this.route.events.subscribe(val => {
const sentraChannelID = this.localStorageService.getMumbleChannelID();
const currentChannelID = this.localStorageService.getActiveChannelID();
this.channel = currentChannelID;
});
NB : Detact on Every Route Change.