angular.js - How to share localStorage across multiple pages in angular?
習慣沉默
習慣沉默 2017-05-15 17:03:56
0
2
633

Now there is a sprinkle function in the project, because form submission is divided into multiple page jump options, I want to set up a local storage that can be shared by multiple pages and record the value of the current form.

習慣沉默
習慣沉默

reply all(2)
左手右手慢动作

localStorage is inherently global and can be used anywhere, without having to consider multiple pages. The method above is very standard! !

習慣沉默

Set a parent route for the form and bind the shared data model to the parent route.

If you use localstorage, just record it and jump to it, and also save an object

localStorage.setItem('key', JSON.stringify(obj));
localStorage.getItem('key', JSON.parse(obj));
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template