implement popup functionality using Route Guards **CanActivate**.so when your route call event call and use localStorage for popup call only once.
import {CanActivate} from "@angular/router";
import {Injectable} from "@angular/core";
@Injectable()
export class Tosaccept implements CanActivate
{
constructor(){}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
{
return this.openTospopup();
return true;
}
openTospopup(){
console.log("isShow: ",localStorage["tosPopupData"]);
if(localStorage["tosPopupData"]==undefined){
localStorage["tosPopupData"] =false;
console.log('openpopcodehere');
}
}
}
and in you route file attach Canactivate like below
{ path: "", component: IndexComponent, canActivate: [Tosaccept]}