title: How to Set & Get in angular2-localstorage?
body: <p>From this <a href="https://github.com/marcj/angular2-localstorage" rel="nofollow noreferrer">repo</a>, I've successfully configured this:</p>
  
  <pre><code>import {Component} from "angular2/core";
  import {LocalStorageService} from "angular2-localstorage/LocalStorageEmitter";
  
  @Component({
      provider: [LocalStorageService]
  })
  export class AppRoot{
      constructor(private storageService: LocalStorageService){}
  ...
  }
  </code></pre>
  
  <p>How can I use storageService to set or get in local storage? I can't find example anywhere even in the doc. </p>
  
  <h2>Updated</h2>
  
  <p>After some testing, I've managed it to get it working with Decorator through WebStorage:</p>
  
  <pre><code>import {LocalStorage, SessionStorage} from "angular2-localstorage/WebStorage";
  
  @Component({})
  export class LoginComponent implements OnInit {
     @LocalStorage() public username:string = 'hello world';
       ngOnInit() {
           console.log('username', this.username);
           // it prints username hello world
       }
  }
  </code></pre>
  
  <p>However, when I used Chrome Dev to see my localstorage, I see nothing there:
  <a href="https://i.stack.imgur.com/5fTD9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5fTD9.png" alt="enter image description here"></a></p>
  
  <p>And In another component, </p>
  
  <pre><code>import {LocalStorage, SessionStorage} from "angular2-localstorage/WebStorage";
  
  @Component({})
  export class DashboardComponent implements OnInit {
     @LocalStorage() public username:string;
       ngOnInit() {
           console.log(this.username);
           // it prints null
       }
  }
  </code></pre>