构建--prod之后,控制台中没有错误,但是在浏览器中,我收到以下错误,并查看了来自github和stackoverflow的所有相关主题 我无法确定我的问题在哪里
操作系统:Windows 10 npm:“ 6.3.0”, 角CLI:6.0.7 节点: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)
我的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();
}
}
}
答案 0 :(得分:0)
这发生在我身上,因为我试图使用“ ngIf”插入一个新的HTML元素。它与服务没有直接关系。就我而言,这是因为我忘记在* ngIf
之前使用“ *”