I have like 15-20 components all of them with forms, and I want to prevent navigation on form dirty. I've seen I can make it trough CanDeactivateGuard, but I do not want to copy/paste same code on every component. I want it more maintainable. How can I do it?
Here's a stackblitz angular example: https://stackblitz.com/angular/onpldekjovy?file=src%2Fapp%2Fcrisis-center%2Fcrisis-detail%2Fcrisis-detail.component.ts