首页 > 解决方案 > 输入'字典' 没有呼叫签名。打字稿,ngRx

问题描述

我正在尝试使用 ngRx 准备信用卡申请。我已经设置了我的操作、减速器和效果,但是在我的减速器结束时,当我尝试访问信用卡 ID 时,我遇到了上述错误。错误是实体没有回调。

    export const getCurrentCreditCard = createSelector(
    getCreditCardFeatureState,
    getCurrentCreditCardId,
    state => state.entities(state.selectedCreditCardId)
    );

代码有点多...请这里是 git repo 的链接。 https://github.com/ProgrammeMitch/credit_card_store_ngrx 请帮忙

标签: angulartypescriptrxjsngrx

解决方案


我对ngrx不太熟悉,但错误似乎表明这state.entities不是一种方法,而是一个Dictionary.

我想也许你只需要使用方括号:

state => state.entities[state.selectedCreditCardId]

推荐阅读