angular - 输入'字典' 没有呼叫签名。打字稿,ngRx
问题描述
我正在尝试使用 ngRx 准备信用卡申请。我已经设置了我的操作、减速器和效果,但是在我的减速器结束时,当我尝试访问信用卡 ID 时,我遇到了上述错误。错误是实体没有回调。
export const getCurrentCreditCard = createSelector(
getCreditCardFeatureState,
getCurrentCreditCardId,
state => state.entities(state.selectedCreditCardId)
);
代码有点多...请这里是 git repo 的链接。 https://github.com/ProgrammeMitch/credit_card_store_ngrx 请帮忙
解决方案
我对ngrx不太熟悉,但错误似乎表明这state.entities
不是一种方法,而是一个Dictionary
.
我想也许你只需要使用方括号:
state => state.entities[state.selectedCreditCardId]
推荐阅读
- reactjs - Reactjs:由孩子触发的父函数调用
- c++ - 我想编写一个连续求和年龄的程序
- excel - 如何使用 laravel 将(oracle)数据库表导出到 excel 表
- javascript - 打字稿用逻辑运算符为变量赋值
- python - 由于未知原因,在 Python 循环中应用多个条件失败
- aws-lambda - AWS Lambda:处理变量输入类型
- google-apps-script - 如何获得我的脚本的云端硬盘权限
- python - 从 django 调用 discord bot 函数
- c++ - 将向上转换指针转换为调用派生虚拟的基础对象
- python - 从网页中抓取 YouTube 链接