In my Angular application, I am handling 404 routing in this manner:
{
path: '404',
loadChildren: () =>
import('../pages/404-pg/404-pg.module').then(
(m) => m.FourZeroFourPgModule
),
},
{
path: '**',
redirectTo: '/404',
}
The redirect works fine, but I've noticed a few 404 logs in my page navigation logs on my deployed website and am currently not logging the url which the user visited which caused the 404 redirect. How can I use the router to determine the "original" route?
For example, if I type: localhost:4200/bad-url in the browser, how can I get the "/bad-url" path using the Router object (or ActivatedRoute, etc)?