To do that with native JavaScript, you would do something like this:
localStorage.setItem('itemKey', JSON.stringify(yourObject));
var item = JSON.parse(localStorage.getItem('itemKey'));
Within the context of angular, you should make a localStorage service as a wrapper around localStorage and inject it into your service or controller. Or you could inject $window
and use it directly off of that like: $window.localStorage
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…