import { Injectable } from "@angular/core" ; import { CanDeactivate , ActivatedRouteSnapshot , RouterStateSnapshot } from "@angular/router" ; @ Injectable ( ) export class BaseCanDeactivate implements CanDeactivate < any > { constructor ( ) { } canDeactivate ( component , currentRoute , currentState , nextState ) { return ( component . canDeactivate ) ? component . canDeactivate ( currentRoute , currentState , nextState ) : true ; } }