title: How to store array of objects in localStorage?
body: <p>I have 3 radio buttons say <code>x</code>, <code>y</code> and <code>z</code>. On <code>click</code> on <code>x</code>, data is loaded and so on..</p>
  
  <p>Now in localStorage, I want to set data for <code>x</code>, <code>y</code> and <code>z</code> differently  and get it.</p>
  
  <p>Here, I'm giving a sample of the program.</p>
  
  <p>Javascript:</p>
  
  <pre><code>var setInLocalStorage = function(){
      //on click of  x radio and getting data from model and called 
      // from one  function
      var x = {
          t = model.x.t;
          d = model.x.d;
      }
      localStorage.setItem('x' ,JSON.stringyfy(x));
  }
  
  var getFromLocalStorage = function() { 
      var obj = JSON.parse(localStorage.getItem('x'));
      //storing back to model
      model.x.t = obj.t;
      model.x.d = obj.d; 
      // populating data on screen which was stored in local storage
      $scope.x.t = model.x.t ;
      $scope.x.d = model.x.d;
  }
  </code></pre>
  
  <p>How to store data of <code>y</code>and <code>z</code> and should display on screen on switching to radio button?</p>