javascript - Using AngularJs UI Router and global variables in single page application -
i creating hybrid quiz application angularjs. have below pseudo code,
- index.html user selects quiz.
- 2nd page using ui-view quiz rendered , user selected options stored in global array (should use global here ?)
- the values in array compared values in answer array (should answers array global? array created querying database , on each new quiz array has change select questions randomly.)
- will both arrays carried forward score view (when using them local arrays or need to make them global or not carried next view?)
i new single page application , ui-router don't know how work.
i don't think should store user's selected options in global variable because these aren't common variable used throughout user session. can save in database when user redirects 2nd page , retrieve on score view screen. also, may need information in future retain user's records.
edit - in case can not store data in database , storing data @ client side option local storage can used.
Comments
Post a Comment