title: How to loop through an array of objects using angularjs
body: <p>I am working on an ionic app that loads data from firebase. In this case I have a .factory called NoteStore that reads a specific table in firebase (eg "lakes").</p>
  
  <pre><code>{
    "lake": {   
       "one": {
          "bio": "xxxx",
          "shortname": "xxxx",
          "name": "xxxxx",
          "reknown": "xxxx",
          "image":"xxxxx"
      },
      "two": {
          "bio": "xxxx",
          "shortname": "xxxx",
          "name": "xxxxx",
          "reknown": "xxxx",
          "image":"xxxxx"
      }
  
    } 
  } 
  </code></pre>
  
  <p>This is the .factory code that reads from firebase:</p>
  
  <pre><code> //get all lake activites
   getAllLakes: function(){
     return $firebaseArray(ref.child('lake'));
   },
  
  //get individual lake activites
   getLake: function(lakeId){
    return $firebaseObject(ref.child('lake').child(lakeId));
  }
  </code></pre>
  
  <p>My app Controller then gets the data through the NoteStore and calling a function "getAllLakes():</p>
  
  <pre><code>app.controller('LakeActivitiesListController', function($scope, NoteStore,              $localStorage) {
  $scope.alllakes = NoteStore.getAllLakes();
  }
  </code></pre>
  
  <p>The main problem is that I want to access individual objects from the "lake" table in firebase so that I can be able to store them in localStorage.</p>
  
  <p>This then displays array of objects as below:
  <img src="https://i.stack.imgur.com/x2sSj.png" alt="array of objects hidden"></p>
  
  <p>When I just create an object as shown below and save to localStorage, it works fine, as shown in the image below.</p>
  
  <pre><code>var myObj = [
  {
    name: 'james',
    title:'doctor'
  
  },
  {
    name: 'jojo',
    title:'doctor'
  
  }
  ];
  console.log(myObj);
  
  
  //
  window.localStorage['lakes'] = JSON.stringify(myObj);
  
  $scope.data = JSON.parse(window.localStorage.getItem('lakes'));
  </code></pre>
  
  <h2>    <img src="https://i.stack.imgur.com/k7WRH.png" alt="stored obj in localStorage"></h2>
  
  <p><img src="https://i.stack.imgur.com/x2sSj.png" alt="this works fine"></p>
  
  <p>I am working on my college project that is overdue. Please help. All I want is to be able to access an array that contains objects from firebase so that I can store them in localStorage.
  Please. </p>