Skip to main content

You can inject Location and subscribe to it

import { Location } from '@angular/common'; ... constructor(location:Location) { location.subscribe(val => console.log(val)); } 

As Harry mentioned. This only notifies about popState events (the router or similar code changing the URL)

You can inject Location and subscribe to it

constructor(location:Location) { location.subscribe(val => console.log(val); } 

As Harry mentioned. This only notifies about popState events (the router or similar code changing the URL)

You can inject Location and subscribe to it

import { Location } from '@angular/common'; ... constructor(location:Location) { location.subscribe(val => console.log(val)); } 

As Harry mentioned. This only notifies about popState events (the router or similar code changing the URL)

Source Link
Günter Zöchbauer
  • 661.5k
  • 235
  • 2.1k
  • 1.6k

You can inject Location and subscribe to it

constructor(location:Location) { location.subscribe(val => console.log(val); } 

As Harry mentioned. This only notifies about popState events (the router or similar code changing the URL)