How to display current route as string


I just made a 404 page to catch any unknown routes, I would like to display on this page not just a “page not found” message, but one that includes whatever string used as the route.

If user goes to localhost:4200/asfsagsagd, I would like 404 router template to say: Page “asfsagsagd” not found.


via initialization object inject the router into controllers, then it can be called in any template via {{router.url}}


Check out this documentation for wildcard routes.