简体   繁体   中英

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

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

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

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