ngx-error-handler
v0.0.3
Published
a common angular error handler
Downloads
5
Readme
A Global Angular Error Handler
Setup
Installation
npm install ngx-error-handler
Sample
- (1) Include AngularErrorHandlerModule in the root Module where you want to use a predefined error-handler.(eg: app.module.ts):
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AngularErrorHandlerModule } from 'ngx-error-handler';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
AngularErrorHandlerModule,
BrowserModule
],
bootstrap: [
AppComponent
],
entryComponents: [
]
})
export class AppModule { }
- (2) Make a statement to instead default error handler by the predefined error-handler.(eg: app.module.ts):
import { AngularErrorHandler } from 'ngx-error-handler';
@NgModule({
...
providers: [
...
{
provide: ErrorHandler,
useClass: AngularErrorHandler
},
...
],
...
})
export class AppModule { }
At Now, you can enjoy yourself without concern about error handler
License
MIT © John Wang