I call a component on a HTML page like this:
<app-my-component></<app-my-component>
What I want it's link a guard canDeactivate
with the component my-component
. This component is never called by a route, so I don't add a path in RouterModule
. I use it in 2 different pages.
How to link the component and the guard without adding something like that:
{ path: 'my-component', component: MyComponent, canDeactivate: [CanDeactivateGuard] }