0

In my NgModule i could previously set a provider using an object as per the below

 providers: [
{ <-- Object 1
  provide: HTTP_INTERCEPTORS,
  useClass: CustomHttpInterceptor,
  multi: true
},
{ <-- Object 2
  provide: SignalrWindow, 
  useValue: window 
},
AppSettings,
AuthenticationService,......

Now when i try set the providers in this manner i get an error when i use AOT compilation stating:

Invalid provider for the NgModule, - only instances of Provider and Type are allowed, got: [[object Object], [object Object] which refers to my two objects....

What is the correct way to specify this object syntax which will allow aot compilation?

Estus Flask
  • 206,104
  • 70
  • 425
  • 565
Piotr Stulinski
  • 9,241
  • 8
  • 31
  • 46

0 Answers0