title: How to fetch data from console output to table using angular2
body: <p><a href="https://i.stack.imgur.com/BMt6J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BMt6J.png" alt="Error Image"></a>I have a table in HTML, i need to fetch data from consoled output to the table. Please help.
  HTML Code:</p>
  
  <pre><code>&lt;table class="table"&gt;
     &lt;tr&gt;
       &lt;th&gt;Completed On&lt;/th&gt;
       &lt;th&gt;ID&lt;/th&gt;
       &lt;th&gt;ParticipantId&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr *ngFor="let data of result"&gt;
       &lt;td&gt;{{ data.completedOn }}&lt;/td&gt;
       &lt;td&gt;{{ data.id }}&lt;/td&gt;
       &lt;td&gt;{{ data.participantId }}&lt;/td&gt;
     &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>TS Code:
  public result:any = [];</p>
  
  <pre><code>   this.service
              .getParticipent(comparedCampaign.id,token)
              .subscribe(
                  participent =&gt; {
                      this.loading = false;
              // this.result = data;
               console.log( this.result);
                      var survey = this.surveyResults;
                      if(participent.length &gt; 0) {
                          var data =[];
                participent.map(function(item) { 
                  var list = survey.filter(function(result) {
                      if(result.participantId) {
                          return result.participantId == item.id
                      }
                 })
                  data.push(list);
                   this.result = data;
                   console.log( this.result);
               })
  
                          console.log(data);
                      } else {
                          alert('No Participent found!');
                      }
                  }, error =&gt; {
                      console.log(error)
                  })
      }
  }
  </code></pre>
  
  <p>From this i need to fetch CompletedOn, id and participantId to the table</p>
  
  <p>JSON Consoled output:</p>
  
  <pre><code> [[{"satisfaction":"[object Object]","completedOn":"2017-08-22T08:52:55.788Z","id":3,"participantId":217},{"satisfaction":{"price":"less","recomondation":"1","winback":"reason6"},"completedOn":"2017-08-22T09:12:40.800Z","id":4,"participantId":217},{"satisfaction":{"price":"less","recomondation":"1","winback":"reason6"},"completedOn":"2017-08-22T11:36:04.861Z","id":5,"participantId":217},{"satisfaction":{"price":"less","recomondation":"1","winback":"reason6"},"completedOn":"2017-08-22T11:59:24.334Z","id":6,"participantId":217},{"satisfaction":{"price":"medium","customer":"yes","recomondation":"2","sales":["phone","Shop","webshop"],"webVist":"5","shopVist":"5","phoneVist":"5","prodandService":["{product_list}"],"importance":["Service"],"frequence":"quarter","satisfaction":"3"},"completedOn":"2017-08-22T12:20:54.280Z","id":7,"participantId":217},{"satisfaction":{"price":"medium","customer":"no","recomondation":"1","winback":"reason1","winback_quality":"reason2"},"completedOn":"2017-08-22T12:22:43.153Z","id":8,"participantId":217},{"satisfaction":{"prodandService":[{"index":"Orbiz"},{"index":"qwerq"},{"index":"asfd"},{"index":"test"},{"index":"test123"},{"index":"TestWD"},{"index":"IOS app"},{"index":"Lipstick"},{"index":"Foundation"},{"index":"lipstick"},{"index":"Website"},{"index":"App IOS"},{"index":"Shampoo Vanilla"},{"index":"Shampoo Strawberry"},{"index":"car"},"Lipstick"],"price":"medium","customer":"yes","recomondation":"4","sales":["phone"],"phoneVist":"3","importance":["Quality"],"frequence":"quarter","satisfaction":"3"},"completedOn":"2017-08-28T09:39:54.676Z","id":10,"participantId":217},{"satisfaction":{"prodandService":[{"index":"Orbiz"},{"index":"qwerq"},{"index":"asfd"},{"index":"test"},{"index":"test123"},{"index":"TestWD"},{"index":"IOS app"},{"index":"Lipstick"},{"index":"Foundation"},{"index":"lipstick"},{"index":"Website"},{"index":"App IOS"},{"index":"Shampoo Vanilla"},{"index":"Shampoo Strawberry"},{"index":"car"},"Foundation","IOS app","test123","test"],"price":"medium","customer":"yes","recomondation":"5","sales":["visits"],"salesVist":"3","importance":["Quality"],"frequence":"year","satisfaction":"5","knowledge":["IOS app","Foundation","Website"],"development":"littleLess","suppliers":"yes","competators":"60","competators_reasons":"Quality","Need":["{product_list}"],"service":"5","collaboration":"4","continuedCollaboration":"3","improvements":["Service","Price"],"winback":"reason3"},"completedOn":"2017-08-28T14:45:13.991Z","id":11,"participantId":217},{"satisfaction":{"prodandService":[{"index":"Orbiz"},{"index":"qwerq"},{"index":"asfd"},{"index":"test"},{"index":"test123"},{"index":"TestWD"},{"index":"IOS app"},{"index":"Lipstick"},{"index":"Foundation"},{"index":"lipstick"},{"index":"Website"},{"index":"App IOS"},{"index":"Shampoo Vanilla"},{"index":"Shampoo Strawberry"},{"index":"car"},"TestWD","Lipstick"],"price":"less","recomondation":"4","sales":["phone"],"phoneVist":"3","importance":["Quality","Assortment"],"frequence":"quarter","satisfaction":"4","knowledge":["IOS app"],"Need":["TestWD","Lipstick"],"development":"same","suppliers":"yes","competators":"60","competators_reasons":"Assortment","service":"4","collaboration":"4","continuedCollaboration":"3","improvements":["Assortment"],"winback":"reason4"},"completedOn":"2017-09-01T14:23:04.533Z","id":13,"participantId":217}]]
  </code></pre>
  
  <p>with error:
  "EXCEPTION: Cannot set property 'result' of undefined"</p>
  
  <p>Please Help.
  Thanks in advance</p>