我想使用 Angular 9 异步管道调用从数据流中接收的函数。
以下代码(onApprove)="(modalData$ | async).onApprove()"
引发此错误:Cannot have a pipe in an action expression
我在网上找不到解决方案,只能参考有关 ngModel 的问题(示例)
<div class="confirm-modal-container">
<div class="title">{{(modalData$ | async).title}}</div>
<div class="body">{{(modalData$ | async).body}}</div>
<app-action-buttons (onApprove)="(modalData$ | async).onApprove()" (onCancel)="(modalData$ | async).onCancel()" [cancelText]="currentStep === 0 ? 'Cancel' : 'Previous'" [approveText]="control[currentStep].actionBtnText"></app-action-buttons>
</div>
数据流来自 Redux store
@select((state: IAppState) => state.ui.modal.modalData) readonly modalData$: Observable<any>;