I have a component and I need to detect if user pressed back button in his browser to navigate back.
Currently I\'m subscribing router events.
constr
As thorin87 answer dont use PlatformLocation. We need subscribe an unsubscribe.
import {Subscription} from 'rxjs/Subscription'; ngOnInit() { this.subscription = this .location .subscribe(() => x => console.log(x)); } ngOnDestroy() { this.subscription.unsubscribe(); }