update ExceptionHandler
was renamed to ErrorHandler
https://stackoverflow.com/a/35239028/217408
orgiginal
This code
var injector = ReflectiveInjector.resolveAndCreate([...]);
creates a new independent injector that doesn't know anything about services provided in your Angular applications.
You might want to inject the injector used by Angular in your application like
class MyExceptionHandler extends ExceptionHandler {
rbJSLogger: RBLoggerService;
constructor(injector:Injector) {
super(null,null);
this.rbJSLogger = injector.get(RBLoggerService);
}
call(error, stackTrace = null, reason = null){
// console.error(stackTrace);
this.rbJSLogger.searchBy("asd");
}
}
or just
class MyExceptionHandler extends ExceptionHandler {
rbJSLogger: RBLoggerService;
constructor(private rbJSLogger:RBLoggerService) {
super(null,null);
}
call(error, stackTrace = null, reason = null){
// console.error(stackTrace);
this.rbJSLogger.searchBy("asd");
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…