import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
@Component({
// ...
})
export class MyComponent implements OnInit {
results: any[];
constructor(private cdr: ChangeDetectorRef) {}
ngOnInit() {
// Call your API to get the results
this.apiService.getResults().subscribe((results) => {
this.results = results;
// Manually trigger change detection to update the UI
this.cdr.detectChanges();
});
}
}