Keep data in page after refresh

前端 未结 3 2000
醉话见心
醉话见心 2020-12-14 11:49

I have 2 pages in my angular project.One of them is main page.The other one is popup page. I enter data to input tags in my popup page,then when i click the add button data

3条回答
  •  借酒劲吻你
    2020-12-14 12:07

    As you said, window.localStorage is a way to go. You store data in localStorage and it will be preserved even after closing session. In angular, you can make a service to streamline access specific data from storage.

    To reload data from localStorage as you enter page, you can use ngOnInit lifecycle hook to load data from storage and fill your view.

提交回复
热议问题