AYKHO
AYKHO

Reputation: 516

No provider for t angular 6

after build --prod there was no error in the console but in browser i got the following error and review all related topic from github and stackoverflow I cannot determine where is my issue

OS: Windows 10 npm: '6.3.0', Angular CLI: 6.0.7 Node: 10.0.0

main.7eb4b93626b33e2ffba6.js:1 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(t)[t -> t]: 
  StaticInjectorError(Platform: core)[t -> t]: 
    NullInjectorError: No provider for t!
Error: StaticInjectorError(t)[t -> t]: 
  StaticInjectorError(Platform: core)[t -> t]: 
    NullInjectorError: No provider for t!
    at t.get (main.7eb4b93626b33e2ffba6.js:1)
    at main.7eb4b93626b33e2ffba6.js:1
    at t (main.7eb4b93626b33e2ffba6.js:1)
    at t.get (main.7eb4b93626b33e2ffba6.js:1)
    at main.7eb4b93626b33e2ffba6.js:1
    at t (main.7eb4b93626b33e2ffba6.js:1)
    at t.get (main.7eb4b93626b33e2ffba6.js:1)
    at Eo (main.7eb4b93626b33e2ffba6.js:1)
    at t.get (main.7eb4b93626b33e2ffba6.js:1)
    at va (main.7eb4b93626b33e2ffba6.js:1)

my app.module

@NgModule({
 imports: [BrowserModule,AppRoutingModule,HttpClientModule,FormsModule,ReactiveFormsModule,BrowserAnimationsModule,ToastrModule.forRoot(),BsDatepickerModule.forRoot(),NgxDataTableModule,AuthModule.forRoot(),NgxPermissionsModule.forRoot(),MatExpansionModule,MatFormFieldModule,MatInputModule,MatIconModule,
    MatDatepickerModule,
    MatNativeDateModule,
    MatButtonModule,
    MatCheckboxModule,
    MatTableModule
  ],
  providers: [
    IntechCommon,
    OidcConfigService,
    OidcSecurityService,
    {
      provide: APP_INITIALIZER,
      useFactory: loadConfig,
      deps: [OidcConfigService],
      multi: true
    },
    ApiService,
    Configuration,
    OidcSecurityService,
    AuthorizationGuard,
    AuthorizationCanGuard
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor(
    private oidcSecurityService: OidcSecurityService,
    private oidcConfigService: OidcConfigService,
    public apiservice: ApiService,
    configuration: Configuration
  ) {
    this.loadUserConfiguration();
  }


  }
}

Upvotes: 2

Views: 1281

Answers (1)

Ivan Arantes
Ivan Arantes

Reputation: 81

This happened to me because I tried to insert a new HTML element using "ngIf". It has nothing to do directly with services. In my case it was because I forgot using " * " before the *ngIf

Upvotes: 1

Related Questions