Skip to content

Commit 168b13d

Browse files
authored
add angular-cli (#749)
* add angular-cli * lines
1 parent 8b8bcb7 commit 168b13d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/integrations/angular2.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,35 @@ Then, in your main module file (where ``@NgModule`` is called, e.g. app.module.t
8282
export class AppModule { }
8383
8484
Once you've completed these two steps, you are done.
85+
86+
Angular CLI
87+
~~~~~~~~~~~
88+
89+
Angular CLI now uses Webpack to build instead of SystemJS. All you need to do is modify your main module file (where ``@NgModule`` is called, e.g. app.module.ts):
90+
91+
.. code-block:: js
92+
93+
import * as Raven from 'raven-js';
94+
import { BrowserModule } from '@angular/platform-browser';
95+
import { NgModule, ErrorHandler } from '@angular/core';
96+
import { AppComponent } from './app.component';
97+
98+
Raven
99+
.config('___PUBLIC_DSN___')
100+
.install();
101+
102+
class RavenErrorHandler implements ErrorHandler {
103+
handleError(err:any) : void {
104+
Raven.captureException(err.originalError);
105+
}
106+
}
107+
108+
@NgModule({
109+
imports: [ BrowserModule ],
110+
declarations: [ AppComponent ],
111+
bootstrap: [ AppComponent ],
112+
providers: [ { provide: ErrorHandler, useClass: RavenErrorHandler } ]
113+
})
114+
export class AppModule { }
115+
116+
Once you've completed that step, you are done.

0 commit comments

Comments
 (0)