angular - 为什么我的 ngrx Effect 将字符串参数转换为数组?
问题描述
行动
我有以下动作:
export const searchTM = createAction(
IocActionTypes.SearchTM,
props<{tm: string}>()
);
零件
我的一个组件中有以下代码:
this.store.dispatch(searchTM(value));
value
字符串在哪里03F
效果
在我的 ngrx 效果文件中,我有以下内容:
searchTM$ = createEffect(() => this.actions$.pipe(
ofType(iocActions.searchTM),
mergeMap(val => this.iocService.getGridRowByTM(val.tm)
.pipe(
map(rowdataraw => iocActions.searchTMFound({rowdataraw})),
catchError(() => {
return EMPTY;
})
)
)
)
);
但是当我在 mergeMap 变量上设置一个调试点时val
,我看到它是这样出现的:
解决方案
问题是我以错误的格式传递参数。
我正在使用:
this.store.dispatch(searchTM(value));
我应该在哪里使用:
this.store.dispatch(searchTM({tm: value}));
推荐阅读
- ios - (Xcode 12 / iOS 14) 如何解决调用 App.Alert 和 SwiftUI.Alert 的兼容性错误?
- java - nextEtnry/closeEntry 上的 ZipInputStream Stream Closed 错误
- r - 如何标记列表中值的逐渐减少
- azure - 如何“监听”天蓝色持久功能的状态变化?
- html - 在不使用 CSS 的情况下删除表格边框顶部
- c# - Graph API - Microsoft Groups - 在创建或更新/修补期间无法启用这两个属性
- sapui5 - 如何通过 UI5 中的 XML 模板覆盖/禁用“对话框”的“escapeHandler”?
- android - Android Hilt - 如何注入 viewModelScope
- elasticsearch - 如何对 Elasticsearch 列表中的所有元素应用布尔查询?
- android - 我正在尝试从 android 移动内存中读取 pdf 文件,但它显示“加载 pdf 错误”