此代码可以正常工作,但是一旦我按“更新”,此消息仍显示如何避免这种情况?
canDeactivate(
component: StaffEditComponent,
currentRoute: ActivatedRouteSnapshot,
currentState: RouterStateSnapshot
): Observable<boolean>|Promise<boolean>|boolean {
if (component.staffEditForm.dirty){
return confirm(`You have unsaved changes. Do You wish to navigate anyways?`);
}
return true;
}