title: How to retrieve the value from LocalStorage
body: <p>I'm trying to test out html5 localStorage feature. For some reason, whenever I try to retrieve a value from storage after refreshing the page, i dont get any value. Values are getting stored locally on my click functionality. But when i refresh the page, it doesnt show the values. </p>
  
  <p><b>src/app.component.ts File </b></p>
  
  <pre><code>&gt;import { Component } from '@angular/core';
  
  &gt;export class MyItems {
    &gt;value: string;
    &gt;constructor(value:string){
      &gt;this.value = value;
   &gt; }
  &gt;}
  &gt;@Component({
    &gt;selector: 'my-app',
    &gt;templateUrl: './app.component.html',
    &gt;styleUrls: [ './app.component.css' ]
  &gt;})
  &gt;export class AppComponent  {
    &gt;title = "Working with Angular";
    &gt;myItems: MyItems[] = new Array();
    &gt;IsForUpdate: boolean = false;
    &gt;newItem: any = {};
   &gt; updatedItem;
  
    &gt;constructor(){
      &gt;this.myItems.push(    
        &gt;new MyItems("First Value"),    
        &gt;new MyItems("Second Value"),    
        &gt;new MyItems("Third Value"),    
        &gt;new MyItems("Forth Value"),    
        &gt;new MyItems("Fifth Value")    
      &gt;);
      &gt;localStorage.setItem("Values", JSON.stringify(MyItems));
      &gt;var getValues = localStorage.getItem("Values");
  
    &gt;}
  
   &gt;AddItem() {    
     &gt;this.myItems.push(    
      &gt; this.newItem    
     &gt;);    
     &gt;this.newItem = {};
     &gt;localStorage.setItem('dataSource', this.newItem);
     &gt;localStorage.getItem('dataSource');    
    // console.log(localStorage.getItem('dataSource'));
  &gt; }  
  
  
   &gt;EditItems(i){
     &gt;this.newItem.value = this.myItems[i].value;
     &gt;this.updatedItem = i;
     &gt;this.IsForUpdate = true;
   &gt;}
  
  
  
  &gt; UpdateItem(){
     &gt;let data = this.updatedItem;
     &gt;for(let i=0; i &lt; this.myItems.length; i++){
      &gt; if(i == data){
        &gt;this.myItems[i].value = this.newItem.value;
       &gt;}
    &gt; }
      &gt;this.IsForUpdate = false;
     &gt; this.newItem = {};
   &gt;}
  
  
   &gt;DeleteItem(i) {
    &gt;var confirmMe = confirm('Do you want to Delete it ?');
    &gt;if(confirmMe == true){
        &gt;this.myItems.splice(i, 1); 
    &gt;} else {
     &gt; alert("You cancelled the Operation");
    &gt;}  
  
  &gt;}  
  &gt;}
  </code></pre>