简体   繁体   中英

Routing back with param in Angular2

In my Angular2 project I have two pages A and B. Page B has parameters, for example http://localhost:4001/pageB/bw0600 has parameter bw0600 .

When user push the button back (<-) in the browser, he hast to be able to go to the previous page A (this works fine) and the parameters (in this case bw0600 should be there too. So, the address of page A should look like

http://localhost:4001/pageA/bw0600

So i need maybe somehow to overwrite the usual behaviour of router back (I don't have button (just (<-) in the browser) , so I can't write the function and bind it to element button)...

How could I solve this?

If you set the parameter to pageA and then forwarded them to pageB, the back button would then go to the correct, parameterized pageA.

As in: pageA => pageA/bw0600 => pageb/bw0600

You could also store the data, and then have pageA always look for the data in localstore or in a shared service when it is loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM