Scipion Scipion - 2 months ago 26
TypeScript Question

Angular2 rc.6 provide doesn't exist anymore

I used to have an

ExceptionHandler
(now
ErrorHandler
)
that I did provide to my module's providers :

import { provide } from "@angular/core"

@NgModule({
providers: [
provide(ExceptionHandler, {useClass: MyExceptionHandler})
]
})


I did rename
ExceptionHandler
to
ErrorHandler
. However, how should I deal with the provide (since it doesn't exist anymore)

Answer

Just use an object { provide: ...}:

@NgModule({
  providers: [
     { provide: ExceptionHandler, useClass: MyExceptionHandler}
  ]
})
Comments