title: getting json data into an array angular2
body: <p>I am not sure what i am missing from my code but currently i am not presented with any errors when i run it but i am also not seeing the results that i am expecting. I have a json file that i am loading into an array and would like to loop through that array and display parts of its data onto the page. </p>
  
  <p>Here is what i have so far: </p>
  
  <p><strong>Service file</strong></p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Http, Response } from '@angular/http';
  import { Observable } from 'rxjs/Observable';
  import 'rxjs/add/operator/catch';
  import 'rxjs/add/operator/map';
  
  @Injectable()
  
  export class AddressDataService{
      addressData: Array&lt;any&gt;;
  
      constructor(private http:Http){ }
      getAddressData(){
          return this.http.get('./api/addressData.json')
                   .map((res:Response) =&gt; res.json());
      }
  }
  </code></pre>
  
  <p><strong>JSON File</strong></p>
  
  <pre><code>[{
      "type": "home",
      "id": 1
  }, {
      "type": "apartment",
      "id": 2
  }, {
      "type": "homeless",
      "id": 3
  }]
  </code></pre>
  
  <p><strong>Component File</strong></p>
  
  <pre><code>import { Http } from '@angular/http';
  import { AddressDataService } from './address.service';
  import { Observable } from 'rxjs/Observable';
  import 'rxjs/add/operator/catch';
  import 'rxjs/add/operator/map';
  
  @Component({
    selector: 'my-app',
    templateUrl: '....',
    styleUrls: ['./styles.css'],
    providers: [AddressDataService]
  })
  
  constructor(private addressDataService: AddressDataService) {}
    addressData = [];
    getAddressData() {
    this.addressDataService.getAddressData()
                     .subscribe(data =&gt; this.addressData = data);
  }
  </code></pre>
  
  <p><strong>HTML File</strong></p>
  
  <pre><code>&lt;div *ngFor="let addressDetail of addressData"&gt;
      {{addressDetail.type}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Am i doing this the right way?</p>