Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

angular how to check previous route

//Update angular 6+
//The events.filter gives error because filter is not part of events, so change the code to

import { filter, pairwise } from 'rxjs/operators';

this.router.events
.pipe(filter((evt: any) => evt instanceof RoutesRecognized), pairwise())
.subscribe((events: RoutesRecognized[]) => {
  console.log('previous url', events[0].urlAfterRedirects);
  console.log('current url', events[1].urlAfterRedirects);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery sum all input values 
Javascript :: disable right click html w3schools 
Javascript :: express serve static files 
Javascript :: how to take input from user nodejs 
Javascript :: Firebase CLI v11.0.1 is incompatible with Node.js v14.17.6 Please upgrade Node.js to version = 14.18.0 
Javascript :: js detect hash change 
Javascript :: onresize js 
Javascript :: js remove specific css property 
Javascript :: js ask before close chrome 
Javascript :: obj[key].includes is not a function 
Javascript :: mathjs get element from matrix 
Javascript :: javascript log error without traceback 
Javascript :: regex para telefone celular 
Javascript :: javascript take any number of arguments 
Javascript :: add favicon to next js static site 
Javascript :: data-widget="pushmenu" collable automatically 
Javascript :: js onchange paramteter sring 
Javascript :: angular mat select open programmatically 
Javascript :: change header background color on scroll css 
Javascript :: event.preventDefault() in react hook 
Javascript :: how to square a value in javascript 
Javascript :: set a timer for 10 minutes 
Javascript :: jquery calculate datetime difference 
Javascript :: quotes api 
Javascript :: jquery first element 
Javascript :: counting duplicates codewars javascript 
Javascript :: js encryption two way 
Javascript :: network response timed out expo 
Javascript :: how to change the color using js 
Javascript :: get value of checked radio button jquery 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =