Angular 6 StaticInjectorError: No provider for Options












7















I have recently updated my project from Angular5 to Angular6.
The project is building successfully but I am getting the following error in the browser console:




Unhandled Promise rejection: StaticInjectorError(AppModule)[options]:
StaticInjectorError(Platform: core)[options]:
NullInjectorError: No provider for options! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[options]




Any idea on how to debug these issues?



Here's my app.module:



import { BrowserModule } from '@angular/platform-browser';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule, Routes } from '@angular/router';
import { CookieModule } from 'ngx-cookie';
import { PushNotificationsModule, PushNotificationsService } from 'ng-push';

// importing notifications module (angular 2 notifications)
import { SimpleNotificationsModule, NotificationsService } from 'angular2-notifications';

import { NgIdleKeepaliveModule } from '@ng-idle/keepalive';

import { NgProgressModule } from '@ngx-progressbar/core';
import { NgProgressHttpClientModule } from '@ngx-progressbar/http-client';

import { GridModule } from './shared-modules/grid-module/grid.module';

// importing components
import { AppComponent } from './app.component';
import { LoginComponent } from './pages/login/login.component';
import { SampleRouteComponent } from './pages/sample-route/sample-route.component';

// services
import { GtmService } from './services/gtm/gtm.service';
import { AuthGuardService } from './services/auth-guard/auth-guard.service';
import { LoginService } from './services/login-service/login.service';
import { UserInfoService } from './services/user-info/user-info.service';
import { UtilityService } from './services/utility/utility.service';
import { IdleService } from './services/idle/idle.service';
import { GenericGridService } from './shared-modules/grid-module/generic-grid.service';
import { HttpInterceptorService } from './services/http-interceptor/http-interceptor.service';
import { ModalProviderService } from './services/modal-provider/modal-provider.service';
import { NotificationServiceService } from './services/notification-service.service';
import { Api } from './services/api';

const routes: Routes = [
{
path: 'login',
component: LoginComponent
},
{
path: 'sample-route',
component: SampleRouteComponent
},
{
path: '',
loadChildren: './shared-modules/container/container.module#ContainerModule',
canLoad: [AuthGuardService]
}
];

@NgModule({
declarations: [
AppComponent,
LoginComponent,
SampleRouteComponent
],
imports: [
BrowserModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: false }),
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
GridModule,
SimpleNotificationsModule,
CookieModule.forRoot(),
NgIdleKeepaliveModule.forRoot(),
NgProgressModule.forRoot(),
NgProgressHttpClientModule,
RouterModule.forRoot(routes, { initialNavigation: 'enabled' }),
PushNotificationsModule
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true
},
GtmService,
LoginService,
AuthGuardService,
UserInfoService,
UtilityService,
IdleService,
ModalProviderService,
NotificationsService,
GenericGridService,
NotificationServiceService,
Api,
PushNotificationsService
],
bootstrap: [AppComponent]
})
export class AppModule {

private loginObserver;

constructor(private loginService: LoginService, private utilityService: UtilityService, private idleService: IdleService,
private userInfoService: UserInfoService) {
this.loginService.checkLoggedIn();
this.loginObserver = this.loginService.loginObserver.subscribe(
loggedIn => {
if (loggedIn) {
const userdata: any = this.userInfoService.getUserInfo();
this.utilityService.createNotification({
title: 'Welcome!!',
content: `${userdata.vchDiplayName}`
});
this.idleService.reset();
this.loginObserver.unsubscribe();
}
}
);
}

}









share|improve this question

























  • You are missing to import a required service. Please show your code.

    – Ulrich Dohou
    Jun 20 '18 at 11:00











  • One of the things going into "providers: [" is null. This could be a module import issue - You can use console.log to identify what one it is....

    – Sam
    Jun 21 '18 at 15:35











  • Hi, do you find a solution for your issue ?

    – Alrick
    Jul 9 '18 at 14:36











  • @Alrick not yet. Still trying

    – Subham Dey
    Jul 10 '18 at 9:36
















7















I have recently updated my project from Angular5 to Angular6.
The project is building successfully but I am getting the following error in the browser console:




Unhandled Promise rejection: StaticInjectorError(AppModule)[options]:
StaticInjectorError(Platform: core)[options]:
NullInjectorError: No provider for options! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[options]




Any idea on how to debug these issues?



Here's my app.module:



import { BrowserModule } from '@angular/platform-browser';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule, Routes } from '@angular/router';
import { CookieModule } from 'ngx-cookie';
import { PushNotificationsModule, PushNotificationsService } from 'ng-push';

// importing notifications module (angular 2 notifications)
import { SimpleNotificationsModule, NotificationsService } from 'angular2-notifications';

import { NgIdleKeepaliveModule } from '@ng-idle/keepalive';

import { NgProgressModule } from '@ngx-progressbar/core';
import { NgProgressHttpClientModule } from '@ngx-progressbar/http-client';

import { GridModule } from './shared-modules/grid-module/grid.module';

// importing components
import { AppComponent } from './app.component';
import { LoginComponent } from './pages/login/login.component';
import { SampleRouteComponent } from './pages/sample-route/sample-route.component';

// services
import { GtmService } from './services/gtm/gtm.service';
import { AuthGuardService } from './services/auth-guard/auth-guard.service';
import { LoginService } from './services/login-service/login.service';
import { UserInfoService } from './services/user-info/user-info.service';
import { UtilityService } from './services/utility/utility.service';
import { IdleService } from './services/idle/idle.service';
import { GenericGridService } from './shared-modules/grid-module/generic-grid.service';
import { HttpInterceptorService } from './services/http-interceptor/http-interceptor.service';
import { ModalProviderService } from './services/modal-provider/modal-provider.service';
import { NotificationServiceService } from './services/notification-service.service';
import { Api } from './services/api';

const routes: Routes = [
{
path: 'login',
component: LoginComponent
},
{
path: 'sample-route',
component: SampleRouteComponent
},
{
path: '',
loadChildren: './shared-modules/container/container.module#ContainerModule',
canLoad: [AuthGuardService]
}
];

@NgModule({
declarations: [
AppComponent,
LoginComponent,
SampleRouteComponent
],
imports: [
BrowserModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: false }),
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
GridModule,
SimpleNotificationsModule,
CookieModule.forRoot(),
NgIdleKeepaliveModule.forRoot(),
NgProgressModule.forRoot(),
NgProgressHttpClientModule,
RouterModule.forRoot(routes, { initialNavigation: 'enabled' }),
PushNotificationsModule
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true
},
GtmService,
LoginService,
AuthGuardService,
UserInfoService,
UtilityService,
IdleService,
ModalProviderService,
NotificationsService,
GenericGridService,
NotificationServiceService,
Api,
PushNotificationsService
],
bootstrap: [AppComponent]
})
export class AppModule {

private loginObserver;

constructor(private loginService: LoginService, private utilityService: UtilityService, private idleService: IdleService,
private userInfoService: UserInfoService) {
this.loginService.checkLoggedIn();
this.loginObserver = this.loginService.loginObserver.subscribe(
loggedIn => {
if (loggedIn) {
const userdata: any = this.userInfoService.getUserInfo();
this.utilityService.createNotification({
title: 'Welcome!!',
content: `${userdata.vchDiplayName}`
});
this.idleService.reset();
this.loginObserver.unsubscribe();
}
}
);
}

}









share|improve this question

























  • You are missing to import a required service. Please show your code.

    – Ulrich Dohou
    Jun 20 '18 at 11:00











  • One of the things going into "providers: [" is null. This could be a module import issue - You can use console.log to identify what one it is....

    – Sam
    Jun 21 '18 at 15:35











  • Hi, do you find a solution for your issue ?

    – Alrick
    Jul 9 '18 at 14:36











  • @Alrick not yet. Still trying

    – Subham Dey
    Jul 10 '18 at 9:36














7












7








7


1






I have recently updated my project from Angular5 to Angular6.
The project is building successfully but I am getting the following error in the browser console:




Unhandled Promise rejection: StaticInjectorError(AppModule)[options]:
StaticInjectorError(Platform: core)[options]:
NullInjectorError: No provider for options! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[options]




Any idea on how to debug these issues?



Here's my app.module:



import { BrowserModule } from '@angular/platform-browser';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule, Routes } from '@angular/router';
import { CookieModule } from 'ngx-cookie';
import { PushNotificationsModule, PushNotificationsService } from 'ng-push';

// importing notifications module (angular 2 notifications)
import { SimpleNotificationsModule, NotificationsService } from 'angular2-notifications';

import { NgIdleKeepaliveModule } from '@ng-idle/keepalive';

import { NgProgressModule } from '@ngx-progressbar/core';
import { NgProgressHttpClientModule } from '@ngx-progressbar/http-client';

import { GridModule } from './shared-modules/grid-module/grid.module';

// importing components
import { AppComponent } from './app.component';
import { LoginComponent } from './pages/login/login.component';
import { SampleRouteComponent } from './pages/sample-route/sample-route.component';

// services
import { GtmService } from './services/gtm/gtm.service';
import { AuthGuardService } from './services/auth-guard/auth-guard.service';
import { LoginService } from './services/login-service/login.service';
import { UserInfoService } from './services/user-info/user-info.service';
import { UtilityService } from './services/utility/utility.service';
import { IdleService } from './services/idle/idle.service';
import { GenericGridService } from './shared-modules/grid-module/generic-grid.service';
import { HttpInterceptorService } from './services/http-interceptor/http-interceptor.service';
import { ModalProviderService } from './services/modal-provider/modal-provider.service';
import { NotificationServiceService } from './services/notification-service.service';
import { Api } from './services/api';

const routes: Routes = [
{
path: 'login',
component: LoginComponent
},
{
path: 'sample-route',
component: SampleRouteComponent
},
{
path: '',
loadChildren: './shared-modules/container/container.module#ContainerModule',
canLoad: [AuthGuardService]
}
];

@NgModule({
declarations: [
AppComponent,
LoginComponent,
SampleRouteComponent
],
imports: [
BrowserModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: false }),
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
GridModule,
SimpleNotificationsModule,
CookieModule.forRoot(),
NgIdleKeepaliveModule.forRoot(),
NgProgressModule.forRoot(),
NgProgressHttpClientModule,
RouterModule.forRoot(routes, { initialNavigation: 'enabled' }),
PushNotificationsModule
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true
},
GtmService,
LoginService,
AuthGuardService,
UserInfoService,
UtilityService,
IdleService,
ModalProviderService,
NotificationsService,
GenericGridService,
NotificationServiceService,
Api,
PushNotificationsService
],
bootstrap: [AppComponent]
})
export class AppModule {

private loginObserver;

constructor(private loginService: LoginService, private utilityService: UtilityService, private idleService: IdleService,
private userInfoService: UserInfoService) {
this.loginService.checkLoggedIn();
this.loginObserver = this.loginService.loginObserver.subscribe(
loggedIn => {
if (loggedIn) {
const userdata: any = this.userInfoService.getUserInfo();
this.utilityService.createNotification({
title: 'Welcome!!',
content: `${userdata.vchDiplayName}`
});
this.idleService.reset();
this.loginObserver.unsubscribe();
}
}
);
}

}









share|improve this question
















I have recently updated my project from Angular5 to Angular6.
The project is building successfully but I am getting the following error in the browser console:




Unhandled Promise rejection: StaticInjectorError(AppModule)[options]:
StaticInjectorError(Platform: core)[options]:
NullInjectorError: No provider for options! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[options]




Any idea on how to debug these issues?



Here's my app.module:



import { BrowserModule } from '@angular/platform-browser';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule, Routes } from '@angular/router';
import { CookieModule } from 'ngx-cookie';
import { PushNotificationsModule, PushNotificationsService } from 'ng-push';

// importing notifications module (angular 2 notifications)
import { SimpleNotificationsModule, NotificationsService } from 'angular2-notifications';

import { NgIdleKeepaliveModule } from '@ng-idle/keepalive';

import { NgProgressModule } from '@ngx-progressbar/core';
import { NgProgressHttpClientModule } from '@ngx-progressbar/http-client';

import { GridModule } from './shared-modules/grid-module/grid.module';

// importing components
import { AppComponent } from './app.component';
import { LoginComponent } from './pages/login/login.component';
import { SampleRouteComponent } from './pages/sample-route/sample-route.component';

// services
import { GtmService } from './services/gtm/gtm.service';
import { AuthGuardService } from './services/auth-guard/auth-guard.service';
import { LoginService } from './services/login-service/login.service';
import { UserInfoService } from './services/user-info/user-info.service';
import { UtilityService } from './services/utility/utility.service';
import { IdleService } from './services/idle/idle.service';
import { GenericGridService } from './shared-modules/grid-module/generic-grid.service';
import { HttpInterceptorService } from './services/http-interceptor/http-interceptor.service';
import { ModalProviderService } from './services/modal-provider/modal-provider.service';
import { NotificationServiceService } from './services/notification-service.service';
import { Api } from './services/api';

const routes: Routes = [
{
path: 'login',
component: LoginComponent
},
{
path: 'sample-route',
component: SampleRouteComponent
},
{
path: '',
loadChildren: './shared-modules/container/container.module#ContainerModule',
canLoad: [AuthGuardService]
}
];

@NgModule({
declarations: [
AppComponent,
LoginComponent,
SampleRouteComponent
],
imports: [
BrowserModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: false }),
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
GridModule,
SimpleNotificationsModule,
CookieModule.forRoot(),
NgIdleKeepaliveModule.forRoot(),
NgProgressModule.forRoot(),
NgProgressHttpClientModule,
RouterModule.forRoot(routes, { initialNavigation: 'enabled' }),
PushNotificationsModule
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true
},
GtmService,
LoginService,
AuthGuardService,
UserInfoService,
UtilityService,
IdleService,
ModalProviderService,
NotificationsService,
GenericGridService,
NotificationServiceService,
Api,
PushNotificationsService
],
bootstrap: [AppComponent]
})
export class AppModule {

private loginObserver;

constructor(private loginService: LoginService, private utilityService: UtilityService, private idleService: IdleService,
private userInfoService: UserInfoService) {
this.loginService.checkLoggedIn();
this.loginObserver = this.loginService.loginObserver.subscribe(
loggedIn => {
if (loggedIn) {
const userdata: any = this.userInfoService.getUserInfo();
this.utilityService.createNotification({
title: 'Welcome!!',
content: `${userdata.vchDiplayName}`
});
this.idleService.reset();
this.loginObserver.unsubscribe();
}
}
);
}

}






angular angular6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 21 '18 at 8:11







Subham Dey

















asked Jun 20 '18 at 9:42









Subham DeySubham Dey

4114




4114













  • You are missing to import a required service. Please show your code.

    – Ulrich Dohou
    Jun 20 '18 at 11:00











  • One of the things going into "providers: [" is null. This could be a module import issue - You can use console.log to identify what one it is....

    – Sam
    Jun 21 '18 at 15:35











  • Hi, do you find a solution for your issue ?

    – Alrick
    Jul 9 '18 at 14:36











  • @Alrick not yet. Still trying

    – Subham Dey
    Jul 10 '18 at 9:36



















  • You are missing to import a required service. Please show your code.

    – Ulrich Dohou
    Jun 20 '18 at 11:00











  • One of the things going into "providers: [" is null. This could be a module import issue - You can use console.log to identify what one it is....

    – Sam
    Jun 21 '18 at 15:35











  • Hi, do you find a solution for your issue ?

    – Alrick
    Jul 9 '18 at 14:36











  • @Alrick not yet. Still trying

    – Subham Dey
    Jul 10 '18 at 9:36

















You are missing to import a required service. Please show your code.

– Ulrich Dohou
Jun 20 '18 at 11:00





You are missing to import a required service. Please show your code.

– Ulrich Dohou
Jun 20 '18 at 11:00













One of the things going into "providers: [" is null. This could be a module import issue - You can use console.log to identify what one it is....

– Sam
Jun 21 '18 at 15:35





One of the things going into "providers: [" is null. This could be a module import issue - You can use console.log to identify what one it is....

– Sam
Jun 21 '18 at 15:35













Hi, do you find a solution for your issue ?

– Alrick
Jul 9 '18 at 14:36





Hi, do you find a solution for your issue ?

– Alrick
Jul 9 '18 at 14:36













@Alrick not yet. Still trying

– Subham Dey
Jul 10 '18 at 9:36





@Alrick not yet. Still trying

– Subham Dey
Jul 10 '18 at 9:36












4 Answers
4






active

oldest

votes


















5














This might be late for OP but I was able to solve this issue by:



Adding the necessary service to my providers list under the app.module.ts



Hope this helps those in the future who are about to encounter this issue.






share|improve this answer
























  • But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

    – Ragul Parani
    Nov 15 '18 at 5:10



















3














Can you try changing the import of SimpleNotificationsModule as SimpleNotificationsModule.forRoot()
I was running into the same error and changing it this way fixed it for me.






share|improve this answer
























  • This worked for me as well

    – Teebo
    Dec 31 '18 at 9:38



















0














Missing some modules with static methods to configure the provider can also make same kind of issue.



For example consider, RouterTestingModule, it has a static method called withRoutes() to configure the provider.



From angular's compiler's and injector's point of view this can be seen as a missing token in the injector.






share|improve this answer































    0














    Can the problem be that you have a non static service? If you have a non static service you must specifiy it as a provider in the Component that uses it. It is not enough to specify it as a provider in the app.modules.ts



    Non static service



    Remove the injectable directive in the service (Usually looks like this)



    @Injectable({
    providedIn: 'root'
    })


    In the Component that uses the non static service



    Add the providers attribute and specify the service. You need to import it too, just as you have to do with regular services as well.



    import { EntryQueueHub } from 'app/services/hubs/entry-queue.hub';
    @Component({
    selector: 'app-image-viewer',
    templateUrl: './image-viewer.component.html',
    styleUrls: ['./image-viewer.component.scss'],
    providers: [EntryQueueHub]
    })
    ...
    constructor (
    private entryQueueHub: EntryQueueHub,
    ...





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50945067%2fangular-6-staticinjectorerror-no-provider-for-options%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      This might be late for OP but I was able to solve this issue by:



      Adding the necessary service to my providers list under the app.module.ts



      Hope this helps those in the future who are about to encounter this issue.






      share|improve this answer
























      • But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

        – Ragul Parani
        Nov 15 '18 at 5:10
















      5














      This might be late for OP but I was able to solve this issue by:



      Adding the necessary service to my providers list under the app.module.ts



      Hope this helps those in the future who are about to encounter this issue.






      share|improve this answer
























      • But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

        – Ragul Parani
        Nov 15 '18 at 5:10














      5












      5








      5







      This might be late for OP but I was able to solve this issue by:



      Adding the necessary service to my providers list under the app.module.ts



      Hope this helps those in the future who are about to encounter this issue.






      share|improve this answer













      This might be late for OP but I was able to solve this issue by:



      Adding the necessary service to my providers list under the app.module.ts



      Hope this helps those in the future who are about to encounter this issue.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Aug 14 '18 at 7:19









      Jero DungogJero Dungog

      915




      915













      • But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

        – Ragul Parani
        Nov 15 '18 at 5:10



















      • But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

        – Ragul Parani
        Nov 15 '18 at 5:10

















      But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

      – Ragul Parani
      Nov 15 '18 at 5:10





      But the idea is to avoid that by adding 'providedIn' in the Injectable, isn't it?

      – Ragul Parani
      Nov 15 '18 at 5:10













      3














      Can you try changing the import of SimpleNotificationsModule as SimpleNotificationsModule.forRoot()
      I was running into the same error and changing it this way fixed it for me.






      share|improve this answer
























      • This worked for me as well

        – Teebo
        Dec 31 '18 at 9:38
















      3














      Can you try changing the import of SimpleNotificationsModule as SimpleNotificationsModule.forRoot()
      I was running into the same error and changing it this way fixed it for me.






      share|improve this answer
























      • This worked for me as well

        – Teebo
        Dec 31 '18 at 9:38














      3












      3








      3







      Can you try changing the import of SimpleNotificationsModule as SimpleNotificationsModule.forRoot()
      I was running into the same error and changing it this way fixed it for me.






      share|improve this answer













      Can you try changing the import of SimpleNotificationsModule as SimpleNotificationsModule.forRoot()
      I was running into the same error and changing it this way fixed it for me.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 29 '18 at 12:06









      PoojaPooja

      314




      314













      • This worked for me as well

        – Teebo
        Dec 31 '18 at 9:38



















      • This worked for me as well

        – Teebo
        Dec 31 '18 at 9:38

















      This worked for me as well

      – Teebo
      Dec 31 '18 at 9:38





      This worked for me as well

      – Teebo
      Dec 31 '18 at 9:38











      0














      Missing some modules with static methods to configure the provider can also make same kind of issue.



      For example consider, RouterTestingModule, it has a static method called withRoutes() to configure the provider.



      From angular's compiler's and injector's point of view this can be seen as a missing token in the injector.






      share|improve this answer




























        0














        Missing some modules with static methods to configure the provider can also make same kind of issue.



        For example consider, RouterTestingModule, it has a static method called withRoutes() to configure the provider.



        From angular's compiler's and injector's point of view this can be seen as a missing token in the injector.






        share|improve this answer


























          0












          0








          0







          Missing some modules with static methods to configure the provider can also make same kind of issue.



          For example consider, RouterTestingModule, it has a static method called withRoutes() to configure the provider.



          From angular's compiler's and injector's point of view this can be seen as a missing token in the injector.






          share|improve this answer













          Missing some modules with static methods to configure the provider can also make same kind of issue.



          For example consider, RouterTestingModule, it has a static method called withRoutes() to configure the provider.



          From angular's compiler's and injector's point of view this can be seen as a missing token in the injector.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 11 '18 at 10:14









          Tibin ThomasTibin Thomas

          1349




          1349























              0














              Can the problem be that you have a non static service? If you have a non static service you must specifiy it as a provider in the Component that uses it. It is not enough to specify it as a provider in the app.modules.ts



              Non static service



              Remove the injectable directive in the service (Usually looks like this)



              @Injectable({
              providedIn: 'root'
              })


              In the Component that uses the non static service



              Add the providers attribute and specify the service. You need to import it too, just as you have to do with regular services as well.



              import { EntryQueueHub } from 'app/services/hubs/entry-queue.hub';
              @Component({
              selector: 'app-image-viewer',
              templateUrl: './image-viewer.component.html',
              styleUrls: ['./image-viewer.component.scss'],
              providers: [EntryQueueHub]
              })
              ...
              constructor (
              private entryQueueHub: EntryQueueHub,
              ...





              share|improve this answer




























                0














                Can the problem be that you have a non static service? If you have a non static service you must specifiy it as a provider in the Component that uses it. It is not enough to specify it as a provider in the app.modules.ts



                Non static service



                Remove the injectable directive in the service (Usually looks like this)



                @Injectable({
                providedIn: 'root'
                })


                In the Component that uses the non static service



                Add the providers attribute and specify the service. You need to import it too, just as you have to do with regular services as well.



                import { EntryQueueHub } from 'app/services/hubs/entry-queue.hub';
                @Component({
                selector: 'app-image-viewer',
                templateUrl: './image-viewer.component.html',
                styleUrls: ['./image-viewer.component.scss'],
                providers: [EntryQueueHub]
                })
                ...
                constructor (
                private entryQueueHub: EntryQueueHub,
                ...





                share|improve this answer


























                  0












                  0








                  0







                  Can the problem be that you have a non static service? If you have a non static service you must specifiy it as a provider in the Component that uses it. It is not enough to specify it as a provider in the app.modules.ts



                  Non static service



                  Remove the injectable directive in the service (Usually looks like this)



                  @Injectable({
                  providedIn: 'root'
                  })


                  In the Component that uses the non static service



                  Add the providers attribute and specify the service. You need to import it too, just as you have to do with regular services as well.



                  import { EntryQueueHub } from 'app/services/hubs/entry-queue.hub';
                  @Component({
                  selector: 'app-image-viewer',
                  templateUrl: './image-viewer.component.html',
                  styleUrls: ['./image-viewer.component.scss'],
                  providers: [EntryQueueHub]
                  })
                  ...
                  constructor (
                  private entryQueueHub: EntryQueueHub,
                  ...





                  share|improve this answer













                  Can the problem be that you have a non static service? If you have a non static service you must specifiy it as a provider in the Component that uses it. It is not enough to specify it as a provider in the app.modules.ts



                  Non static service



                  Remove the injectable directive in the service (Usually looks like this)



                  @Injectable({
                  providedIn: 'root'
                  })


                  In the Component that uses the non static service



                  Add the providers attribute and specify the service. You need to import it too, just as you have to do with regular services as well.



                  import { EntryQueueHub } from 'app/services/hubs/entry-queue.hub';
                  @Component({
                  selector: 'app-image-viewer',
                  templateUrl: './image-viewer.component.html',
                  styleUrls: ['./image-viewer.component.scss'],
                  providers: [EntryQueueHub]
                  })
                  ...
                  constructor (
                  private entryQueueHub: EntryQueueHub,
                  ...






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 21 '18 at 9:57









                  OlofOlof

                  12




                  12






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50945067%2fangular-6-staticinjectorerror-no-provider-for-options%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith