ng-reapeat will iterate over any object or array. How you store, hydrate,
modify, load, save, this in the model is up to you. As long as you remember
to call $scope.$apply after an async operation that is performed outside of
angular, then it should be reflected in the ng-repeat.

So yes, you can save/load data to localStorage, and if you replace your
model that is referenced by the ng-repeat, it should update.

is this what your asking?



On 20 March 2014 20:18, Srikar Shastry <[email protected]> wrote:

> 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.
>



-- 
Tony Polinelli

-- 
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.

Reply via email to