1
我在構造函數或組件的ngOnInit函數中拋出錯誤。組件構造函數中的異常後,Angular2路由不起作用
它由我的CustomErrorHandler處理,但在它發生之前,它會中斷路由。
Uncaught (in promise): Error: Error in http://localhost:8666/app/modules/orders/orders.component.html:1:46 caused by: Constructor error
Error: Error in http://localhost:8666/app/modules/orders/orders.component.html:1:46 caused by: Constructor error at ViewWrappedError.ZoneAwareError
(http://localhost:8666/node_modules/zone.js/dist/zone.js:811:33) at ViewWrappedError.BaseError [as constructor]
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:1190:20) at ViewWrappedError.WrappedError [as constructor]
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:1248:20) at new ViewWrappedError
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:6633:20) at CompiledTemplate.proxyViewClass.DebugAppView._rethrowWithContext
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:12903:27) at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:12876:22) at CompiledTemplate.proxyViewClass.AppView.internalDetectChanges
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:12711:22) at CompiledTemplate.proxyViewClass.View_OrdersComponent_Host0.detectChangesInternal
(/OrdersModule/OrdersComponent/host.ngfactory.js:29:19) at CompiledTemplate.proxyViewClass.AppView.detectChanges
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:12726:18) at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:12873:48) at ViewRef_.detectChanges
(http://localhost:8666/node_modules/@angular/core/bundles/core.umd.js:9915:24) at RouterOutlet.activate
(http://localhost:8666/node_modules/@angular/router/bundles/router.umd.js:5027:46) at ActivateRoutes.placeComponentIntoOutlet
(http://localhost:8666/node_modules/@angular/router/bundles/router.umd.js:4302:20) at ActivateRoutes.activateRoutes
(http://localhost:8666/node_modules/@angular/router/bundles/router.umd.js:4269:30) at eval
(http://localhost:8666/node_modules/@angular/router/bundles/router.umd.js:4205:62)
似乎無法正常工作 – Cuel
@Cuel通常情況下,應用程序發生異常。自定義錯誤處理程序僅允許您執行錯誤日誌記錄(例如,向服務器) 無法保證應用程序在未捕獲的異常之後能夠或可以恢復到可用狀態。 –