Angular detect if the page is changed

import { NavigationEnd, Router } from '@angular/router';

    this._router.events.subscribe((event) => {
      if(event instanceof NavigationEnd) {
         console.log(event);
         if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){

          this.sidebarStatus = true;
          this._headerService.toggleSidebarNav(this.sidebarStatus);
        }
         
      }
  });

Leave a Reply

Your email address will not be published. Required fields are marked *