Since upgrading to angular 15, I've encountered a problem where the this.router.getCurrentNavigation() method is returning null when trying to access a state property passed to the router. This state property was initially set using router.navigate in another component.
In Component A:
https://i.stack.imgur.com/zs5DS.png
In Component B:
https://i.stack.imgur.com/tR941.png
I am able to access the state in Component B by using this.state = history.state;
. However, the code
this.state = this.router.getCurrentNavigation()?.extras?.state ?? {};
does not work as getCurrentNavigation() returns null. Can anyone explain why?