Wednesday, 15 February 2012

javascript - How to ng-repeat over an object stored in Local Storage -


I have a scope function that gives the object (in JSON format) that it gets from local storage (this service Using):

  $ scope.getLsKeys = function () {$ scope.lsKeys = localStorageService.get ('accountKeys'); Return $ scope.lsKeys; };  

I want to iterate back to the object's property with a ng-repeat:

   
  Uncheck error: [$ rootScope: infdig] 10 $ digest () iterations reached being aborted! Hidden watchers in the last 5 iterations: [[fn: $ watchCollectionWatch; NewVal: 81; OldWall: 79]], ["Fn: $ Watch CollectionWatch; NewWell: 83; OldWall: 81"], ["FN: $ Watch CollectionWatch; New" Volume: 85; Old Val: 83 "], [" Fn: $ Watch Collection Watch; Newell: 87; Oldwall: 85 "], [" Fn: $ Watch Collection Watch; Newell: 89; Old attempt: 87 "]]  

All attempts to use" track "by NG-repeat fail, because the archive is stored as an object, an array (I can not change my coworker code to make that change unfortunately). Is there any way to solve this problem easily?

I have the only solution which is $ scope. Instead of lsKeys, you have to walk again and whenever Local storage is modified, update it, but it is indeed the complete purpose of Kang.

Edit: Local storage has been modified during application runtime and it has to be read by angular; That is, do not need to call getLsKeys during run-time, not just the initialization.

To populate a scope object, you ng-enter :

& lt; button ng-repeat = "lske in item" ng-init = "lsakey = meldakek ()" & gt; & gt; button & gt;

No comments:

Post a Comment