Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get previous url angular

  // private router: Router//inject
    this.router.events
    .pipe( filter(        (evt:any)=>evt instanceof RoutesRecognized),pairwise())
    .subscribe((events: RoutesRecognized[]) =>{        
        console.log('previous',events[0].urlAfterRedirects);//previous url
        console.log('current url',events[1].urlAfterRedirects);//current url
      }    );
 
PREVIOUS NEXT
Tagged: #previous #url #angular
ADD COMMENT
Topic
Name
4+5 =