How to determine previous page URL in Angular?

Maybe all other answers are for angular 2.X. Now it doesn’t work for angular 5.X. I’m working with it. with only NavigationEnd, you can not get previous url. because Router works from “NavigationStart”, “RoutesRecognized”,…, to “NavigationEnd”. You can check with router.events.forEach((event) => { console.log(event); }); But still you can not get previous url even with … Read more

Angular 2: 404 error occur when I refresh through the browser [duplicate]

Update for Angular 2 final version In app.module.ts: Add imports: import { HashLocationStrategy, LocationStrategy } from ‘@angular/common’; And in NgModule provider, add: {provide: LocationStrategy, useClass: HashLocationStrategy} Example (app.module.ts): import { NgModule } from ‘@angular/core’; import { BrowserModule } from ‘@angular/platform-browser’; import { AppComponent } from ‘./app.component’; import { HashLocationStrategy, LocationStrategy } from ‘@angular/common’; @NgModule({ declarations: … Read more