FYI I am very new to Angular2 - basically I'm calling a data service that returns a promise of an array of objects, which I bind in my view and loop through them. It is working great, but I started exploring how to use a infinite scroll which would require me to append onto the array, but I cannot get this to work.
This is how I declare the array in the component (typescript):
integrationCollection: IntegrationEntity[] = [];
And this is the data service call:
this.integrationService.getIntegrations().then(integrationCollection => this.integrationCollection = integrationCollection);
And the results are displayed just fine on the page. But the length property returns 0.. why would this be ??
alert('integrationCollection count: ' + this.integrationCollection.length); // returns 0
Also, I'm going to need to be able to add to my array for an infinite scroll scenario, so I think I need to be able to concat the array - but this is not working at all (no errors, but nothing is displayed on the page):
this.integrationService.getIntegrations().then(integrationCollection => this.integrationCollection.concat(integrationCollection));
I think maybe these two problems are related? I think I'm just missing something fundamental.
Thanks for any insight.
getIntegrations()call is finished. I'm not sure about the second issue.this.integrationService.getIntegrations().then(integrationCollection => this.integrationCollection = this.integrationCollection.concat(integrationCollection));