У меня есть проект ionic3, и я пытаюсь использовать ngrx-store.Я создал простой редуктор, action, model и app.state.Получение ошибки ниже, когда я просто добавляю редуктор в app.module.ts.Редуктор пока не используется ни в одном компоненте.
Unhandled Promise rejection: Cannot read property 'schedule' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'schedule' of undefined
at ObserveOnSubscriber.scheduleMessage (observeOn.js:93)
at ObserveOnSubscriber._error (observeOn.js:99)
at ObserveOnSubscriber.Subscriber.error (Subscriber.js:106)
at ActionsSubject.Observable._trySubscribe (Observable.js:177)
at ActionsSubject.Subject._trySubscribe (Subject.js:97)
at ActionsSubject.Observable.subscribe (Observable.js:160)
at ObserveOnOperator.call (observeOn.js:69)
at AnonymousSubject.Observable.subscribe (Observable.js:157)
at WithLatestFromOperator.call (withLatestFrom.js:69)
at AnonymousSubject.Observable.subscribe (Observable.js:157) TypeError: Cannot read property 'schedule' of undefined
at ObserveOnSubscriber.scheduleMessage (http://localhost:8100/build/vendor.js:55994:33)
at ObserveOnSubscriber._error (http://localhost:8100/build/vendor.js:56000:14)
at ObserveOnSubscriber.Subscriber.error (http://localhost:8100/build/vendor.js:20763:18)
at ActionsSubject.Observable._trySubscribe (http://localhost:8100/build/vendor.js:331:18)
at ActionsSubject.Subject._trySubscribe (http://localhost:8100/build/vendor.js:23279:51)
at ActionsSubject.Observable.subscribe (http://localhost:8100/build/vendor.js:314:93)
at ObserveOnOperator.call (http://localhost:8100/build/vendor.js:55970:23)
at AnonymousSubject.Observable.subscribe (http://localhost:8100/build/vendor.js:311:22)
at WithLatestFromOperator.call (http://localhost:8100/build/vendor.js:92156:23)
at AnonymousSubject.Observable.subscribe (http://localhost:8100/build/vendor.js:311:22)
У меня есть простой редуктор
import * as BudgetActions from './budget.actions'
import { BudgetCategory } from './budget.model'
export function budgetReducer(state: BudgetCategory[] = [], action : BudgetActions.Actions) {
switch(action.type) {
case BudgetActions.GET_ALL_BUDGET_CATEGORIES:
return state;
case BudgetActions.ADD_BUDGET:
return [...state, action.payload];
case BudgetActions.REMOVE_BUDGET:
//splice the budget based on the id in payload
return state;
case BudgetActions.STORE_ALL_BUDGET_CATEGORIES:
state = action.payload;
return state;
default:
return state;
}
}
Любые предложения, которые я могу попробовать, пожалуйста?
Позвольте мнеузнайте, может ли какая-либо другая часть кода помочь вам подумать над предложением.