Here is a route setup I am working with:
path: ':id', component: ViewBookPageComponent },
After adding this route, an error keeps popping up:
Error: Cannot read property 'id' of null
I haven't included a null check in the component because I expect the property to be available once the component is navigated to. The authentication guard is redirecting to login
before any book routes are shown.
You can find a demo of the issue here on StackBlitz:
If I remove the route, the error disappears, indicating that Angular might be instantiating the component before routing to it.