2015-10-06 48 views
1

我想定製默認的異常處理程序行爲,並要做到這一點,我想重寫ExceptionHandler類,但是當我使用下一個錯誤時出現下一個錯誤代碼Module'「angular2/angular2」'沒有導出成員'ExceptionHandler'

錯誤:

Module '"angular2/angular2"' has no exported member 'ExceptionHandler'. 

代碼:

import {ExceptionHandler} from 'angular2/angular2'; 

這是正確的形式給出?從哪裏或什麼我必須導入?

+0

[在Angular2定製異常處理程序(的可能的複製http://stackoverflow.com/questions/32488245/custom-exception-handler- in-angular2) – DerekMT12

回答

4

我認爲這是錯誤。 ExceptionHandler必須導出here,但事實並非如此。

現在的體驗,你可以導入ExceptionHandler,如:

import { ExceptionHandler } from 'angular2/src/core/facade/exceptions'; 

退房this plunker

+0

在[email protected]我使用...從'angular2/src/facade/exceptions'導入{ExceptionHandler}; – inki

相關問題