Suppose I have a HasChangesGuard which is injected in the app.routes.ts file.
e.g.
path: 'SomePath', component: SomeComponent, canDeactivate: [HasChangesGuard], outlet: 'someOutlet' },
And suppose I also have a navigation treeview from DevExpress
HTML
<dx-tree-view ... (onItemClick)="onItemClick($event)" ..../>
Typescript
public async onItemClick(e: any): Promise<void> {
....
const node: ITreeViewNode = e.itemData;
this.selectedNode = node; // this setter then adds a css property to the DOM.
}
The problem is now, when I am in the treeview and I navigate to SomeComponent and I do some changes without saving them and then click on another item, a dialog pops up because I have declared so in the HasChangesGuard, but when clicking cancel. The navigationTreeView has no clue what I pressed and will highlight the clicked node either way.
So how could I pass (or rather await) the result from the HasChangesGuard (called by a route change) to the navigation component?