Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

ngOnInit() is executing twice

We are creating own tag for our component in that parent tag (Query group) should call child tag each grid (table) but ngOnInit() called twice in parent. The code is below:

this.source = "http://entitlements/rest/data/queryv2/page_builder_repo_ms/vw_query_group_details/";
var sample = "assets/sampleQueryGroup.json";/*For testing only ! */
this.httpClient.get(sample, { observe: 'response', params: postPayLoad }).subscribe(resp => {

  console.log('      resp.body.toStr   ' + JSON.stringify(resp.body['Response']['Rows']));
  var self = this;
  resp.body['Response']['Rows'].forEach(function (row,index){
    self.items.push(row);
  });
  console.log("  lenght  ====    "+this.items.length);
})

Comments