在 Angular 10 及以上版本中,由于 Angular Compiler Options 的更改,通过使用 AOT 和 IVY 编译器时,必须在应用中手动导入 AsyncPipe。要解决此问题,可以按以下步骤操作:
import { AsyncPipe } from '@angular/common';
providers: [ AsyncPipe ]
{{ yourObservable | async }}
以上步骤应该可以解决“Error: The pipe 'async' could not be found!”错误。