刷新页面时保留页面数据 [英] Retain page data on refreshing the page

查看:39
本文介绍了刷新页面时保留页面数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 angular 的新手.我正在使用获取对象列表并将它们显示在第一页上的服务.然后根据单击的对象,我在下一页设置选项卡标题.但是,当我刷新页面时,列表的范围丢失了,并且选项卡标题引发了异常,导致页面不显示信息.有没有办法在刷新第二页时保留上一屏点击哪个对象的信息?

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 on the next page. But while I am refreshing the page the scope of the list is lost and the tab header is throwing the exception resulting the page to not display the information. Is there any way to retain the information that which object was clicked on previous screen even when refreshing the 2nd page?

推荐答案

你可以利用 angular 本地存储

You can make use of angular local storage

Angular 本地存储

示例如何使用它:

使用本地存储的示例

这篇关于刷新页面时保留页面数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆