angular.js - AngularJs作为SPA应用该如何保存数据呢?
伊谢尔伦
伊谢尔伦 2017-05-15 16:56:24
0
2
546

angularjs是单页应用,对于全局需要用到的数据可以使用services来实现共享,但是如果当用户刷新页面后,貌似一切都重新开始了,类似于开了新的生命周期,那样整个应用岂不是不健壮了么?
或者说是需要在本地localstorage中保存一份数据?请问该怎么解决

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (2)
習慣沉默

The SPA I know will use local storage combined with server-side storage. Server-side storage can solve the restart problem you mentioned above. You can also allow users to log in and bind relevant data to the user. Of course, the specifics still depend on the needs of the project.

    给我你的怀抱

    1 Isn’t it natural that the page should be refreshed after pressing F5? What if my SPA is refreshed? It does not change any user habits, and users will not feel confused.
    2 Instead, users should slowly develop the habit of not having to press F5 in SPA.
    3 I feel that what needs to be done is to save the user login status. This can be stored in the session of the server. It is the same as traditional web applications and has nothing special.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!