search

Home  >  Q&A  >  body text

angular.js - How does AngularJs save data as a SPA application?

angularjs is a single-page application. You can use services to share data that needs to be used globally. However, if the user refreshes the page, everything seems to start over, similar to opening a new life cycle, so that the entire application Isn’t it unfit?
Or do you need to save a copy of data in local storage? Please tell me how to solve it

伊谢尔伦伊谢尔伦2822 days ago650

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-15 16:58:24

    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.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-15 16:58:24

    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.

    reply
    0
  • Cancelreply