In Angular, I understand how to use a wildcard routing to show a custom 404 page. However that only covers the case of a non-existing component.
What about the case where the user reached an existing component, but passed a non-existing ID?
For example /widgets/12345 where 12345 does not exist in the database.
What is the best practice in this case to show a 404?
I managed to redirect the user to a 404 page by catching the error. But that does not seem right: you don't usually get redirected for a 404, you expect to stay on the same URL but with a 404 page instead.