How to Pass ID one page to another page using Angular?

Viewed 24

My question is, do I want to pass the id from one page to another page? without using Routing and local storage. if we stored in the service file, once refresh the page. it is collapsed, so, please tell me the possible ways.

Thanks

1 Answers

There are many ways by which you can have state management and share your state across different components

  • Using Services
  • State Management library like NgRx

But all this ways will lose the data when you reload the page, so to handle that situation you have to take additional steps

  • For Services: You can store the data in local/session storage and maintain them as per security requirements
  • For NgRx: You can use a library or write your own functionality leveraging local/session storage

You can also leverage your backend for storing data based on your application requirements

Related