Ask Your Question

How can I add an Angular back button to the stack router outlet in Chrome?

asked 2022-01-08 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-08-08 07:00:00 +0000

bukephalos gravatar image

To add an Angular back button to the stack router outlet in Chrome, you can follow the below steps:

  1. Import the Location service in your component
import { Location } from '@angular/common';
  1. Inject the Location service in your component's constructor
constructor(private location: Location) { }
  1. Add a method to go back to the previous page
goBack() {
  1. In your template, add a button with a click event that triggers the goBack() method
<button (click)="goBack()">Back</button>
  1. You can style the button according to your preference using CSS.

With these steps, you should be able to add a back button to your stack route outlet in Chrome.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2022-01-08 11:00:00 +0000

Seen: 15 times

Last updated: Aug 08 '21