[英]Using AngularJs UI Router and global variables in single page application
I am creating a hybrid quiz application with AngularJS. 我正在用AngularJS创建一个混合测验应用程序。 I have below pseudo code,
我有下面的伪代码,
I am new to single page application and UI-Router so don't know how does it all work. 我是单页应用程序和UI-Router的新手,所以不知道它们如何工作。
I don't think you should store user's selected options in Global variable because these aren't common variable to be used throughout the user session. 我认为您不应该将用户选择的选项存储在Global变量中,因为这些不是在整个用户会话中都可以使用的通用变量。 You can save it in database when user redirects to 2nd page and retrieve on score view screen.
当用户重定向到第二页并在分数视图屏幕上检索时,您可以将其保存在数据库中。 Also, You may need this information in future to retain the user's records.
另外,您将来可能需要此信息来保留用户的记录。
EDIT - In case you can not store data in database and storing data at client side is only option then local storage can be used. 编辑 -如果您不能将数据存储在数据库中,并且仅在客户端存储数据,则可以使用本地存储。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.