0

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
     }  
Chellappan வ
  • 23,645
  • 3
  • 29
  • 60
Solution
  • 1
  • 1
  • I have did some changes in your question please take a look and if you want to ask something different then edit your question again, please proper code what you really want to do.. – Jason0011 Jan 16 '23 at 09:51

0 Answers0