Skip to main content

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import 'rxjs/add/operator/filter'; import { Router, NavigationEnd } from '@angular/router;router'; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import 'rxjs/add/operator/filter'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import 'rxjs/add/operator/filter'; import { Router, NavigationEnd } from '@angular/router'; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import 'rxjs/add/operator/filter'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import 'rxjs/add/operator/filter'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 

The pairwise operator allows to get the current together with the previous value

update  

import 'rxjs/add/operator/pairwise'; import {Router} from '@angular/router; export class AppComponent { constructor(private router: Router) { this.router.events .filter(e => e instanceof NavigationEnd) .pairwise().subscribe((e) => { console.log(e); }); } } 

See also How to detect a route change in Angular?

original (super old)

Inject Router and subscribe to events and store them for later reference

constructor(private _router: Router) { this._router.subscribe(route => { this.nextRoute ... this.prevRoute ... }); 
edited body
Source Link
Günter Zöchbauer
  • 661.5k
  • 235
  • 2.1k
  • 1.6k
Loading
deleted 1 character in body
Source Link
Ramesh Rajendran
  • 38.9k
  • 49
  • 159
  • 241
Loading
added 155 characters in body
Source Link
Günter Zöchbauer
  • 661.5k
  • 235
  • 2.1k
  • 1.6k
Loading
added 45 characters in body
Source Link
Günter Zöchbauer
  • 661.5k
  • 235
  • 2.1k
  • 1.6k
Loading
Source Link
Günter Zöchbauer
  • 661.5k
  • 235
  • 2.1k
  • 1.6k
Loading