Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

angular how to get previous state

//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 :: insert value to html input with javascript variable 
Javascript :: javascript oncontextmenu 
Javascript :: react localstorage remove item 
Javascript :: javascript generate a random number between two numbers thats not 1 
Javascript :: jquery on enter click 
Javascript :: react native text area align top 
Javascript :: js push into array if item exist 
Javascript :: sort an array by characters length in js 
Javascript :: js are you sure alert 
Javascript :: jQuery.easing[this.easing] is not a function 
Javascript :: socket io broadcast to room 
Javascript :: nodejs require everything without prefix 
Javascript :: react router catch all 404 
Javascript :: electron communicate between main and renderer 
Javascript :: html form clear 
Javascript :: get value of element html js 
Javascript :: angular formarray remove all 
Javascript :: jquery datepicker re initialize 
Javascript :: adminlte 3 toasts 
Javascript :: get screen width javascript 
Javascript :: save list of dictionaries to json python 
Javascript :: video js toggle play pause 
Javascript :: set value to element paragraph in javascript 
Javascript :: v-switch vuex store 
Javascript :: phone number validation regex 
Javascript :: React Native BUILD FAILED on run-ios 
Javascript :: javscript generate empty 2d array 
Javascript :: even number function in javascript 
Javascript :: npm express async handler 
Javascript :: onclick add class javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =