-1

For example, page C has a Go Back button,

Page A -> Page C With data, click it, back to page A With data. Page B -> Page C With data, click it, back to page B With data.

576prakash
  • 45
  • 7
  • What have you tried so far?? – Ronak Thakkar Oct 23 '17 at 08:32
  • It is not that different with click back without data. Your data could be in a shared service between two components. So when you go from one component to the other, this latter could use the data from the previous one. Or the data could be fetched from the server. And this data is fetched during the initialization of your components, typically using `ngOnInit` for instance. So you can use the data of page A on the other pages B and C and vice versa. – edkeveked Oct 23 '17 at 10:04
  • 5
    Possible duplicate of [How to go back last page in Angular 2](https://stackoverflow.com/questions/35446955/how-to-go-back-last-page-in-angular-2); If you want to see how to share data between components [link](https://stackoverflow.com/questions/40468172/how-to-share-data-between-components-using-a-service-properly) – edkeveked Oct 23 '17 at 10:08

1 Answers1

1

Assuming the data changes between pages you could either store in a database an create a service to access this data.

OR

Use localstorage to store the data temporarily in the users browser and get the item on a different page

localStorage.setItem('data', {name: "576prakash "})

localStorage.getItem('data');
Kay
  • 17,906
  • 63
  • 162
  • 270