The problem is that the UI thread will display the child component before subscribing from the observable is complete.
you need to do it like this:
import { ChangeDetectorRef } from '@angular/core';
constructor(private ref: ChangeDetectorRef) {}
ngOnInit() {
this.http.get('url').subscribe(data => {
this.results = data;
this.ref.markForCheck();
});
}
and in HTML you must first check the value.
<ng-container *ngIf="results != null">
<app-childComponent [dataNeeded]=results></app-childComponent>
</ng-container>
, .markForCheck()
, ", , ng-. , , , .