我试图将我在Angular 5.2.11和ngrx 5.2.0中构建的SPA转换为通用应用。
通过我的组件轻松重用我的POST / GET请求的主要策略是为每个请求创建一个reducer,订阅它们并在我需要检索某些API数据和管理时从组件调度一个动作UI状态,变量配置来自我的商店。
没有商店订阅和发送的所有页面都运行良好,但拥有它们的页面却没有。当我尝试点击这些页面时,这是我的节点服务器在控制台中打印的错误:
ERROR { Error: Uncaught (in promise): Error
at resolvePromise (C:\Users\UserName\Desktop\GitHub\Projects\Services\O
ngoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zone-node.js
:814:31)
at resolvePromise (C:\Users\UserName\Desktop\GitHub\Projects\Services\O
ngoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zone-node.js
:771:17)
at C:\Users\UserName\Desktop\GitHub\Projects\Services\Ongoing Projects\
experiences-2018-test\app\node_modules\zone.js\dist\zone-node.js:873:17
at ZoneDelegate.invokeTask (C:\Users\UserName\Desktop\GitHub\Projects\S
ervices\Ongoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zon
e-node.js:421:31)
at Object.onInvokeTask (C:\Users\UserName\Desktop\GitHub\Projects\Servi
ces\Ongoing Projects\experiences-2018-test\app\node_modules\@angular\core\bundle
s\core.umd.js:4789:33)
at ZoneDelegate.invokeTask (C:\Users\UserName\Desktop\GitHub\Projects\S
ervices\Ongoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zon
e-node.js:420:36)
at Zone.runTask (C:\Users\UserName\Desktop\GitHub\Projects\Services\Ong
oing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zone-node.js:1
88:47)
at drainMicroTaskQueue (C:\Users\UserName\Desktop\GitHub\Projects\Servi
ces\Ongoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zone-no
de.js:595:35)
at ZoneTask.invokeTask (C:\Users\UserName\Desktop\GitHub\Projects\Servi
ces\Ongoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zone-no
de.js:500:21)
at ZoneTask.invoke (C:\Users\UserName\Desktop\GitHub\Projects\Services\
Ongoing Projects\experiences-2018-test\app\node_modules\zone.js\dist\zone-node.j
s:485:48)
at data.args.(anonymous function) (C:\Users\UserName\Desktop\GitHub\Pro
jects\Services\Ongoing Projects\experiences-2018-test\app\node_modules\zone.js\d
ist\zone-node.js:1317:25)
at FSReqWrap.oncomplete (fs.js:152:21)
rejection: [Error],
promise: ZoneAwarePromise { __zone_symbol__state: 0, __zone_symbol__value: [Er
ror] },
zone:
Zone {
_properties: { isAngularZone: true },
_parent:
Zone {
_properties: {},
_parent: null,
_name: '<root>',
_zoneDelegate: [Object] },
_name: 'angular',
_zoneDelegate:
ZoneDelegate {
_taskCounts: [Object],
zone: [Circular],
_parentDelegate: [Object],
_forkZS: null,
_forkDlgt: null,
_forkCurrZone: [Object],
_interceptZS: null,
_interceptDlgt: null,
_interceptCurrZone: [Object],
_invokeZS: [Object],
_invokeDlgt: [Object],
_invokeCurrZone: [Circular],
_handleErrorZS: [Object],
_handleErrorDlgt: [Object],
_handleErrorCurrZone: [Circular],
_scheduleTaskZS: [Object],
_scheduleTaskDlgt: [Object],
_scheduleTaskCurrZone: [Circular],
_invokeTaskZS: [Object],
_invokeTaskDlgt: [Object],
_invokeTaskCurrZone: [Circular],
_cancelTaskZS: [Object],
_cancelTaskDlgt: [Object],
_cancelTaskCurrZone: [Circular],
_hasTaskZS: [Object],
_hasTaskDlgt: [Object],
_hasTaskDlgtOwner: [Circular],
_hasTaskCurrZone: [Circular] } },
task:
ZoneTask {
_zone:
Zone {
_properties: [Object],
_parent: [Object],
_name: 'angular',
_zoneDelegate: [Object] },
runCount: 0,
_zoneDelegates: null,
_state: 'notScheduled',
type: 'microTask',
source: 'Promise.then',
data: ZoneAwarePromise { __zone_symbol__state: 0, __zone_symbol__value: [Er
ror] },
scheduleFn: undefined,
cancelFn: null,
callback: [Function],
invoke: [Function] } }
我很确定这是因为ngrx库或角度的HttpClientModule,但我无法追踪此错误的来源,因为这与zone-node.js库有关
有人知道为什么会这样,以及如何解决这个问题?
谢谢!