Angular has CanDeactivate
guard, but you have to declare it to each path in the routes configuration.
Valid until angular/angular#11836 will be done.
You can use CanActivateChild
guard to prevent leaving from any component with single declaration.