title: Error in ionic2 when JSON data is not present
body: <p>I made an API which takes db data and passes JSON data to ionic2 app.The data may have data accordingly to what key is sent by the user.So all the data may not be present for all users at the same time and that's why i have written a common code for all the users. My issue is when data node is not present in JSON file then the page breaks saying "undefined" object. How do i solve this?<br></p>
  
  <p><strong>Typescript Method</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>displayData()
    {
      if(this.responseDetails[0].DocumentTypeDetails.Deed.Checked)
      this.showDeed= this.responseDetails[0].DocumentTypeDetails.Deed.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.Amend.Checked)
      this.showAmend=this.responseDetails[0].DocumentTypeDetails.Amend.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.MortgageDeed.Checked)
      this.showMortDeed=this.responseDetails[0].DocumentTypeDetails.MortgageDeed.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.MortgageRefi.Checked)
      this.showMortRefi=this.responseDetails[0].DocumentTypeDetails.MortgageRefi.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.MortgageMod.Checked)
      this.showMortMod=this.responseDetails[0].DocumentTypeDetails.MortgageMod.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.Assignment.Checked)
      this.showAssign=this.responseDetails[0].DocumentTypeDetails.Assignment.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.ReleaseSatisfaction.Checked)
      this.showRelSatisfaction=this.responseDetails[0].DocumentTypeDetails.ReleaseSatisfaction.Checked=="True"?1:0;
      if(this.responseDetails[0].DocumentTypeDetails.poa.Checked)
      this.showPOA=this.responseDetails[0].DocumentTypeDetails.poa.Checked=="True"?1:0;
      }
  </code></pre>
  
  
  
  <p><strong>JSON</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>"DocumentTypeDetails": {
              "PageRec": "AL005",
              "State": "AL",
              "County": "Autauga County",
              "CityTown": null,
              "Zip": null,
              "ShowRecordingInfo": "true",
              "Deed": {
                  "Checked": "True",
                  "Pages": "1",
                  "ConsiderationAmount": "150000"
              },
              "MortgageDeed": {
                  "Checked": "False",
                  "Pages": null,
                  "NewDebtAmount": null
              },
              "MortgageRefi": {
                  "Checked": "False",
                  "Pages": null,
                  "NewDebtAmount": null,
                  "OriginalDebt": null,
                  "UnpaidDebt": null
              },
              "Assignment": {
                  "Checked": "False",
                  "Pages": null,
                  "Assignments": null
              },
              "ReleaseSatisfaction": {
                  "Checked": "False",
                  "Pages": null,
                  "ReleasesSatisfactions": null
              }
              }
  </code></pre>
  
  
  
  <p>Here in JSON file we don't have all the data for this user but for another one some of the missing data might be present.Is there any check for this?</p>
  
  <p><strong>More to Typescript file</strong></p>
  
  <pre class="lang-js prettyprint-override"><code> private responseUrl='http://localhost:58682/home/index1';
  
     getresponseDetails(){
          return    this.http.get(this.responseUrl).map(res=&gt;res.json());
      }
  
  
       LoadResponseData(){
        this.service.getresponseDetails()
        .subscribe(data=&gt;{
          this.responseDetails=data;
        }
  </code></pre>
  
  
  
  <p><strong>Error</strong></p>
  
  <pre><code>ERROR TypeError: Cannot read property 'Checked' of undefined
      at CalculatePage.displayData (calculate.ts:186)
      at CalculatePage.ngOnInit1 (calculate.ts:111)
      at SafeSubscriber._next (calculate.ts:93)
      at SafeSubscriber.__tryOrUnsub (Subscriber.js:234)
      at SafeSubscriber.next (Subscriber.js:183)
      at Subscriber._next (Subscriber.js:125)
      at Subscriber.next (Subscriber.js:89)
      at MapSubscriber._next (map.js:83)
      at MapSubscriber.Subscriber.next (Subscriber.js:89)
      at XMLHttpRequest.onLoad (http.es5.js:1205)
  </code></pre>