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 !

3

2 Answers 2

1

Try with Location.back like this:

import {Location} from '@angular/common'; constructor(private location: Location) { } goBack() { this.location.back(); } 
Sign up to request clarification or add additional context in comments.

Comments

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> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.