title: Angular 2 101: defining and using a variable
body: <p>All I'm trying to do is get my head around Angular 2 syntax. The examples I find seem to use different methods.</p>
  
  <p>Look at <strong>foo</strong>:</p>
  
  <p>Is this how I set up every single variable I want to use?</p>
  
  <p>I define it using : syntax, and specify its type?
  Then later I refer to it with this.?</p>
  
  <pre><code>export class SwitchClientComponent implements OnInit {
      filterString: string = '';
      foo: string ='';
  
  
      ngOnInit() {
  
          this.foo = localStorage.getItem('bar') || '!';
      }
  </code></pre>
  
  <p>.    </p>
  
  <pre><code>    &lt;span&gt;[{{foo}}]&lt;/span&gt;
  </code></pre>