D
D
Demigodd2019-04-02 10:22:06
JavaScript
Demigodd, 2019-04-02 10:22:06

How to return to the page you came from in Angular?

For example, there are pages A, B, C.
If you go from A to B , then when you click on the Cancel button , you need to go to page A ,
the same for C -> B -> cancel -> C.
I implemented it like this when $state.go from A to B I pass some previousPage parameter , which has the name of the previous page, in this case page A . And when I click on Cancel I do $state.go with the previousPage parameter . Also works for C
page too.
The disadvantage of this implementation is that when the page is updated in $state.params, this previousPage disappears and now it is not clear where to go during Cancel .
Any ideas?
How to correctly implement the transition to the previous page. How are they ideally implemented?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Medin K, 2019-04-02
@Demigodd

There is history.back()
https://javascript.ru/window.history

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question