How to go back to last visited route in Angular
All the route changes are pushed to the browser location
state. We can simply tap into it and try to go back in time. 😉
ts
import { Location } from '@angular/common';constructor(private readonly location: Location) { }goBack() {this.location.back();}