public constructor(private location: Location) {
} // Constructor //
@HostListener("window:popstate", ["$event"])
private popState(ev: PopStateEvent): void {
console.log(ev.state);
} // Procedure //
And somewhere do:
this.location.go("url", "", {data: 42});
The reason I'm using location instead of router, is I don't want the router to be changed to that component (only when navigating with the address in the browser), as I have animation transition from a list item to be expanded.
In the popstate, you'd expect ev.state.data to be 42, but there is just ev.state.navigationId .. So I'm sure data:42 is stored somewhere in Angular land, just not sure how to get it.