title: Angular can't read property data of undefined
body: <p>I'm having an issue with calling my data from a json file.  When I click a button to have it appear in a textarea, it does nothing for the first click, but works like expected after that.  What the program does is gets an id from dashboard and based on that id grabs different json file to pull in. 
  The program shows an error of: </p>
  
  <p>ERROR TypeError: Cannot read property 'data' of undefined
      at StepService.webpackJsonp.102.StepService.populateList (step.service.ts:69)
      at CalibrationDetailComponent.webpackJsonp.101.CalibrationDetailComponent.next</p>
  
  <p>step.service.ts</p>
  
  <pre><code>private jsonData: any; //Json data
  public list: String[] = []; //Holds the list of steps
  public listLength: number; //Length of the list
  public listCurrent: number = 0; //Current step the list is on
  
  //Gets the json file
    public getJson(): Observable&lt;any&gt; {
      return this.http.get(this.jsonUrl)
        .map(response =&gt; response.json());
    }
  
    //Subscribe
    public subScribe2Json() {
      this.getJson().subscribe(data =&gt; (this.jsonData = data));
    }
  
    //Populates the list from the json so I can pull out specific steps
    public populateList() {
      this.jsonData.data.forEach(element =&gt; { //The line that throws the error
        this.list.push(element.name);
      });
      this.listLength = this.list.length;
    }
  
    //Returns the mainStepText with the current step
    public getJsonData(): String {
      this.mainStepText = this.list[this.listCurrent];
      return this.mainStepText;
    }
  </code></pre>
  
  <p>calibration-detail.component.ts</p>
  
  <p>next button method</p>
  
  <pre><code>next() { //Advances step
      this.stepService.subScribe2Json();
      if (this.stepService.listCurrent &lt; 1) { //Makes sure only runs once to populate the list
        this.stepService.populateList(); //Populates list from the json array
       }
      if (this.stepService.listCurrent &lt; this.stepService.listLength) { //make sure dont go past number of steps
          this.stepService.subScribe2Json(); //Sub to list
          this.mainStepText = this.stepService.getJsonData(); //Grab the data from the list and output to main textarea
          this.stepService.listCurrent ++; //Increments the step
  </code></pre>