I have a page that I can access it from to two diff pages , and in this page, I have a button [BACK] and I want to redirect the user back to the page he comes from, can anyone give any tips. Back Thanks
Asked
Active
Viewed 42 times
-2
-
2You can get the help of given [link](https://stackoverflow.com/questions/35446955/how-to-go-back-last-page) . There are many ways to implement back button. `window.history.back();` , use `Location` builtin service , etc. – Denuka May 13 '19 at 09:05
-
Thanks also for your comment – Ilia Tapia May 13 '19 at 09:12
1 Answers
2
You can use angular Location
package back
method, it ll redirect the user to the previous page.
import { Location } from '@angular/common';
constructor(
private location: Location
) { }
goBack() {
this.location.back();
}

Nithya Rajan
- 4,722
- 19
- 30
-
-
well done! I just want to have the opportunity to do other question. – Ilia Tapia May 13 '19 at 11:35