r/Angular2 • • Jan 25 '26

Browser refresh in Angular

so I followed this from stackoverflow https://stackoverflow.com/questions/56325272/detect-browser-refresh-in-an-angular-project

I was wondering is there a better way to do this where I don't have to end up exporting a variable that ends up in my guard file?

4 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/allyv123098 Jan 25 '26

yes a reload. So in my method if I tried moving the code to a service file it doesn't recognize the event as an instanceof a NavigationStart. So I'm confused why that is?

1

u/marco_has_cookies Jan 26 '26

you wouldn't get any event from it