I want to code when user click On logout button candeactivate automatically call to.. after that logout want to show logout popup which is "can you leave this page"
import { CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
canDeactivate(component: FormComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot)
{
// nextState apply in your code
if (nextState.url == "/auth/login") {
return true;
}
else
{
//write here logic
}