2017-02-14 10 views
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)

答えて

0

私はそれが予想される動作だと思います。 カスタムエラーハンドラでApplicationRef.tick()を呼び出すと、再度ルーティングが行われるはずです。

+0

動作していないようです。 – Cuel

+0

@Cuel通常、例外はアプリケーションの障害です。カスタムエラーハンドラは、(サーバなどの)エラーロギングを行うことのみを許可するものです キャッチされない例外が発生した後にアプリケーションを使用可能な状態に戻すことはできません。 –

関連する問題