我使用NgRX创建了角应用程序。我增加了行动,减速器,服务和效果。但是,在访问时,该操作在组件代码中得到了以下错误。
错误:“EmployeeAction”类型中不存在属性“GetEmployees”。
找到下面的代码片段:
在EmployeeComponent中:
this.store.dispatch(new EmployeeAction.GetEmployees());
雇员-行动:
export class GetEmployees implements Action {
readonly type = GET_EMPLOYEES;
}
The entire App code will be available in this Github repository.
https://github.com/techvenky/AngularNgRx/tree/master/src发布于 2020-05-07 21:11:34
导入抽象类并尝试创建其属性的实例。GetEmployees它是一个类,导入它并转到它。所以,您的分派必须如下所示:this.store.dispatch(new GetEmployees());
此外,我还建议您从操作类的构造函数中的有效负载属性中删除readonly。
https://stackoverflow.com/questions/61667683
复制相似问题