title: remove array object from localStorage Angular
body: <p>In my Ionic Framwork App i have a cart array stored in the angular localStorage
  like this </p>
  
  <pre><code>localStorage.setItem('mycart', JSON.stringify(items));
  </code></pre>
  
  <p>and i retrieve the localStorage Array like this</p>
  
  <pre><code>var cart_items = JSON.parse(localStorage.mycart);
  </code></pre>
  
  <p><strong>Output</strong> </p>
  
  <pre><code>[{"id":"1","item_name":"pepsi","qty":"2"},{"id":"2","item_name":"coke","qty":"2"},
  {"id":"3","item_name":"fanta","qty":"3"}]
  </code></pre>
  
  <p>i am trying to remove an product item using the below code. but it does not work, it removes the entire item in the array</p>
  
  <pre><code>for ( var i = 0; i &lt; cart_items.length; i++ ) {
      if ( cart_items[i].id === $removeId ) { //
         cart_items.splice(i,1); 
      }
  }
  localStorage.mycart= JSON.stringify(cart_items );
  </code></pre>
  
  <p>it removes all the items in the array</p>