0
I need to display an Alert every time my main Component changes route, so I created the following script in my AppComponent
:
constructor(private router: Router) {
router.events.subscribe((val) => {
alert(val);
});
}
However it displays Alert several times, but it displays the first one correctly, can I display only the first subscribe? value and ignore the rest? giving Alert only once inside the subscribe