Getting an infinite loop trying iterate through the promise resulting from this function call:
public CUSTOMERS = [
{"id":1,"name":"Crypto Joe", "description":"Love Crypto in the Morning"},
{"id":1,"name":"Crypto Sue", "description":"Love Crypto in the Evening"}
];
loadCustomers():Promise<any[]> {
return of(this.CUSTOMERS).toPromise()
}
And this is the template:
<li *ngFor="let customer of loadCustomers() | async">
<h3>{{customer.name}}</h3>
<code> {{customer.description}} </code>
</li>
</ul>
Thoughts? This is a stackblitz demo:
https://stackblitz.com/edit/minimal-angular-ngfor-loop
I updated the demo to use changeDetection: ChangeDetectionStrategy.OnPush
but it still results in an infinite loop. Perhaps this can only be done with observables?