title: Angular 2 - Typescript - Rx - Interface member undefined
body: <p>I have below interface;</p>
  
  <pre><code>  export interface IDetail {
    name: string;
    office: string;
    addresses: Address[];
    }
  
    interface Address{
      street: string;
      zip: number;
    }
  </code></pre>
  
  <p>My service method,</p>
  
  <pre><code> getDetails(id: number): Observable&lt;IDetail&gt; {
   return this._http.get(this._apiUrl+ "/" + id)
    .map((response: Response) =&gt; &lt;IDetail&gt;response.json())
    .catch(this.handleError);
  </code></pre>
  
  <p>On component ngOnInit method,</p>
  
  <pre><code>ngOnInit(): void {
      this.getDetailsService(id)
      .subscribe(data =&gt; {
          this.detail = data;
          console.log(this.detail);
          this.AccessAddress();
      },
      error =&gt; this.errorMessage = &lt;any&gt;error);
     }
  
  AccessAddress(): void{
  //After service call, trying to read addresses member
   let addresses = this.detail.addresses;
  }
  </code></pre>
  
  <p>Inside subscribe method, i see output for IDetail in console.</p>
  
  <p>After service call, when trying to read addresses member i am get the below error,
  <strong><em>ERROR TypeError: Cannot read property 'addresses' of undefined</em></strong></p>
  
  <p>On html file, i can able access the address member and display on UI.</p>
  
  <pre><code>&lt;div *ngFor="let address of detail.addresses"&gt;
     {{address.street}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Do I need the change interface to class? or I need to initialize the addresses member before accessing it? or something else with Observable?</p>