title: Cannot read property of undefined in angular2
body: <p>I am using Angular 2 and am making an API call to get back some JSON. The call works and I get a response.</p>
  
  <pre><code>export class DetailsPage {
  
    public userID;
    v: any = {};           
  
    constructor(public navCtrl: NavController, public navParams: NavParams, public http: Http) {
  
      this.userID = navParams.get('userID');
  
      var headers = new Headers();
      headers.append('Content-Type', 'application/x-www-form-urlencoded');  
  
      let urlSearchParams = new URLSearchParams();
      let body = urlSearchParams.toString();
  
      this.http.get('http://api.domain.com/visitor/'+this.userID, {headers:headers}).map(res =&gt; res.json()).subscribe(data =&gt; {
          this.v = data.res;
      }); 
  
    }
  
  }
  </code></pre>
  
  <p>Within my template I have:</p>
  
  <pre><code>&lt;pre&gt;{{v | json}}&lt;/pre&gt;
  </code></pre>
  
  <p>And this shows me my JSON ...</p>
  
  <pre><code>{
    "user": {
      "id": "794149",
      "tag_name": "",
      "tag_id": "0",
      "tag_style": {
        "color": null,
        "font": null,
        "style": "label-default"
      }
    },
  </code></pre>
  
  <p>But how can I display the user's ID?</p>
  
  <p>I have tried ..</p>
  
  <pre><code>{{ v.user.id }}
  </code></pre>
  
  <p>But this gives me an error:</p>
  
  <pre><code>Error in ./DetailsPage class DetailsPage -  caused by: Cannot read property 'id' of undefined
  </code></pre>