Retain page data on refreshing the page

前端 未结 4 923
猫巷女王i
猫巷女王i 2020-12-18 21:20

I am new to angular. I am using a service which gets a list of objects and displays them on the 1st page. Then based on what object was clicked, I am setting the tab header

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 22:01

    The best practice to handle these kind of scenarios is through combination of angular service + localstorage

    • Service will help you to transfer data between two pages / controllers.
    • And saving that data to localstorage will help you to get that data on page refresh

    And if the data is just the id in url then answer by @Michal Stefanow is fine also.

    Helping link

    • Data Between controllers through service

提交回复
热议问题