0

I want to return to the previous page where i were before the actual page.How to set that ?

i tried putting urls but how to know the previous one?

 <div class="row">
        <div class="col"><a href="#" class="hi-arrow-round-left">Back 
        </a>
        </div>
 </div>

i'm expeting when clicking on "Back" to go to the previous page but i'm getting home page caused by "#" because i'don't know how to get the previous page !

SS_FStuck
  • 231
  • 1
  • 5
  • 20

2 Answers2

1

Try with Location.back like this:

import {Location} from '@angular/common';

  constructor(private location: Location) {
  }

  goBack() {
    this.location.back();
  }
Ghoul Ahmed
  • 4,446
  • 1
  • 14
  • 23
0

You can add function to the a tag:

<a href="#" class="hi-arrow-round-left" onclick="goBack()">Back </a>

The function is:

<script>
function goBack() {
  window.history.back();
}
</script>