What is the right way to wait for data in Angular?

I have a child-component `CheckboxListComponent` which shows a list of checkboxes. The list is populated in `ngOnInit` through a webservice-call which takes more or less time. It also has a function `setEntryChecked` to set a specific item to checked. When `foo()` is called before the `CheckboxListComponent` has it’s data the call was lost or has no effect. My solution is to wait for the result to be available with `await this.listSubject.first().toPromise()`. Is there a better way to do this in TypeScript? Continue reading “What is the right way to wait for data in Angular?”