Hello,
I have base model as service which store the content into the localstorage
(stackoverflow example, mine is almost the same):
app.factory('userService', ['$rootScope', function ($rootScope) {
var service = {
model: {
name: '',
email: '',
"testArray": [
{
"first": 1,
"second": 2,
"third": "abc"
},
{
"first": 4,
"second": 5,
"third": "xyz"
}
]
},
SaveState: function () {
sessionStorage.userService = angular.toJson(service.model);
},
RestoreState: function () {
service.model = angular.fromJson(sessionStorage.userService);
}
}
$rootScope.$on("savestate", service.SaveState);
$rootScope.$on("restorestate", service.RestoreState);
return service;}]);
Now, I have ng-repeat with input type text on each repeat and has ng-model
respectively.
I'm trying to capture these ng-models in the above base model as ARRAY(not
object) and then, store the object model in the localstorage.
How can I store ng-repeat array in the localStorage? Will the current approach
work?
Thank you.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.