@hicoder/angular-cli
Version:
Angular UI componenets and service generator. It works with the mean-rest-express package to generate the end to end web application. The input to this generator is the Mongoose schema defined for the express application. mean-rest-express exposes the Res
12 lines (10 loc) • 386 B
text/typescript
import { CanDeactivate } from '@angular/router';
import { CanDeactivateComponent } from './app/can-deactivate';
export class ConfirmDeactivateGuard implements CanDeactivate<CanDeactivateComponent> {
canDeactivate(toBeDeactivated: CanDeactivateComponent) {
if(toBeDeactivated.hasChanges()){
return window.confirm('Do you really want to go?');
}
return true;
}
}