在Angular 2应用程序中,我将一些数据从HomeComponent传递到PageComponent,然后将其保存到PageComponent内部的变量中.现在,当我刷新页面时,我需要保留这些数据.目前,我正在使用会话存储,但我想知道是否有更好的方法来实现此目的.
In my Angular 2 app, I pass in some data to a PageComponent from my HomeComponent which is then saved to a variable inside the PageComponent. Now when I refresh the page I need this data to be retained. Currently I am using session storage, but I was wondering if there is a better way to implement this.
推荐答案不,在这种情况下没有其他方法.刷新后,所有临时内存都消失了.如您所说,您正在执行会话存储.您可以继续.您可以选择以下内容.
Nope, There isn't a other way in this context. Once you refresh all the temporary memory is gone. As you said you are performing session-storage. You may continue with that. You may choose the below.
区别和重要性:如何将令牌存储在Angular 2的本地存储或会话存储中?
更多推荐
在Angular 2中重新加载页面时保留数据
发布评论