0
有在ASP核心SPA模板3個不同app.module文件ASP核心角SPA模板module.ts配置
- app.module.client.ts
- app.module.server.ts
- app.module.shared.ts
我已將我的服務包含在app.module.shared.ts提供程序中,但它仍顯示沒有在運行時定義的提供程序。通常我們有一個角度爲app.module.ts的文件,當我在那裏定義我的服務時它工作得很好。任何幫助將不勝感激。
app.module.share.ts
export const sharedConfig: NgModule = {
bootstrap: [ AppComponent ],
declarations: [
AppComponent,
DashboardComponent,
NavComponent,
SidebarComponent,
PluginComponent,
HomeComponent,
DashboardUIComponent,
SchoolInfoComponent,
HomeMainComponent,
StudentInfoComponent,
NavMainComponent,
LoginComponent,
RegisterComponent,
ClassInfoComponent,
ClassComponent
],
imports: [
BrowserModule,
RouterModule.forRoot(APP_ROUTES),
],
providers: [MenuService, VariablesService, navPillsService] };
app.module.client.ts
@NgModule({
bootstrap: sharedConfig.bootstrap,
declarations: sharedConfig.declarations,
imports: [
BrowserModule,
FormsModule,
HttpModule,
...sharedConfig.imports
],
providers: [
{ provide: 'ORIGIN_URL', useValue: location.origin, ...sharedConfig.providers }
] }) export class AppModule { }
app.module.server.ts
@NgModule({
bootstrap: sharedConfig.bootstrap,
declarations: sharedConfig.declarations,
imports: [
ServerModule,
...sharedConfig.imports
],
providers: sharedConfig.providers }) export class AppModule { }
錯誤:
謝謝,它現在的工作:) –