I want to back in history if exist in Angular 7.*?
I used the following:
import { Location } from '@angular/common';
constructor(private location: Location) {
}
get isBackHistoryExist(): boolean {
return window.history.length > 1;
}
back(): void {
this.location.back();
}
But window.history.length > 1
is always true !