Something like
For example, page C has a Go Back button,
Page A -> Page B -> Page C, click it, back to page A and keep the page A do not refresh
Does router can be achieved? Thanks
Something like
For example, page C has a Go Back button,
Page A -> Page B -> Page C, click it, back to page A and keep the page A do not refresh
Does router can be achieved? Thanks
This is the best way:
import {Component} from '@angular/core';
import {Location} from '@angular/common';
@Component({
// component's declarations here
})
class SomeComponent {
constructor(private location: Location) {
}
backClicked() {
this.location.back();
}
}
This works fine!
First: Import Location as in the line 2;
Second: Inject in the constructor as in the line;
Third: Use calling this.location.back();
, where location
is the name declared in the constructor
source: How to go back last page