Suppose ,I have three routes A->B->C
,I go to B from A ,and then to C from B
Now I want to move to A directly From C. Is this possible ?
Suppose ,I have three routes A->B->C
,I go to B from A ,and then to C from B
Now I want to move to A directly From C. Is this possible ?
You can try with Location
Class in angular/common
.
It has method historyGo()
Example if you want to go to previous to previous component
import {
Location
} from "@angular/common"
class A {
constructor(private location: Location) {}
goBackTo() {
this.historyGo(-1)
}
}
As per docs
Position of the target page in the history relative to the current page. A negative value moves backwards, a positive value moves forwards, e.g. location.historyGo(2) moves forward two pages and location.historyGo(-2) moves back two pages
Also you can look at this answer