gpt4 book ai didi

angular - ionic /Angular : The pipe 'async' could not be found

转载 作者:行者123 更新时间:2023-12-03 23:43:19 25 4
gpt4 key购买 nike

当试图访问可观察的 holidayEntries$: Observable<HolidayEntry[]>在 html 中

<ion-list lines="full" *ngFor="let holiday of holidayEntries$ | async">
<ion-label>
<h1>{{ holiday.author }}</h1>
</ion-label>
</ion-list>
我总是收到以下错误:

core.js:6228 ERROR Error: Uncaught (in promise):
Error: The pipe 'async' could not be found!


我读过 CommonModule可能会丢失,如 here 中所述,但我将其导入相应的 .module.ts文件。
知道我做错了什么吗?
编辑:
我的模块
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HolidaysPageRoutingModule
],
declarations: [HolidaysPage]
})
export class HolidaysPageModule {}
我的组件
@Component({
selector: 'app-tab2',
templateUrl: './holidays.page.html',
styleUrls: ['./holidays.page.scss'],
})
export class HolidaysPage implements OnInit {
currentUser$: Observable<UserVM>;
holidayEntries$: Observable<HolidayEntry[]>;

constructor(
private readonly appStore: Store<fromApp.State>,
private readonly holidayStore: Store<fromHoliday.State>) {

this.currentUser$ = appStore.select(fromAuth.selectAuthUser).pipe(
map(user => new UserVM(user))
);

this.holidayEntries$ = holidayStore.select(fromHoliday.selectHolidayEntries)
}

loadHolidays() {
console.log("loading holidays")
this.holidayStore.dispatch(HolidayActions.loadHolidayRequests())
}
}

最佳答案

如果您正在加载的路由上的组件未声明(通过声明:[]),那么您也会收到此类错误。从功能模块中删除功能组件的声明并添加到 app.module.ts (通过声明:[])

关于angular - ionic /Angular : The pipe 'async' could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64423745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com