Open web-dave opened 7 years ago
...
import { NgRedux } from '@angular-redux/store';
@Injectable()
export class LeaveGuard implements CanDeactivate<BookNewComponent> {
constructor(private ngRedux: NgRedux<IAppState>) { }
...
}
...
canDeactivate(target: BookNewComponent) {
if (this.ngRedux.getState().formdirty) {
return window.confirm('Do you really want to cancel?');
} else {
return true;
}
}
...
NgRedux
intoleave-guard
viaDI