Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit f3b7103

Browse files
In AngularSpa template, redefine app.module.shared as a real NgModule. Fixes #986.
1 parent 0dd2406 commit f3b7103

File tree

5 files changed

+33
-30
lines changed

5 files changed

+33
-30
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
import { AppModuleShared } from './app.module.shared';
4+
import { AppComponent } from './components/app/app.component';
5+
6+
@NgModule({
7+
bootstrap: [ AppComponent ],
8+
imports: [
9+
BrowserModule,
10+
AppModuleShared
11+
],
12+
providers: [
13+
{ provide: 'ORIGIN_URL', useValue: location.origin }
14+
]
15+
})
16+
export class AppModule {
17+
}

templates/AngularSpa/ClientApp/app/app.module.client.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

templates/AngularSpa/ClientApp/app/app.module.server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { NgModule } from '@angular/core';
22
import { ServerModule } from '@angular/platform-server';
3-
import { sharedConfig } from './app.module.shared';
3+
import { AppModuleShared } from './app.module.shared';
4+
import { AppComponent } from './components/app/app.component';
45

56
@NgModule({
6-
bootstrap: sharedConfig.bootstrap,
7-
declarations: sharedConfig.declarations,
7+
bootstrap: [ AppComponent ],
88
imports: [
99
ServerModule,
10-
...sharedConfig.imports
10+
AppModuleShared
1111
]
1212
})
1313
export class AppModule {
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { FormsModule } from '@angular/forms';
4+
import { HttpModule } from '@angular/http';
25
import { RouterModule } from '@angular/router';
36

4-
import { AppComponent } from './components/app/app.component'
7+
import { AppComponent } from './components/app/app.component';
58
import { NavMenuComponent } from './components/navmenu/navmenu.component';
69
import { HomeComponent } from './components/home/home.component';
710
import { FetchDataComponent } from './components/fetchdata/fetchdata.component';
811
import { CounterComponent } from './components/counter/counter.component';
912

10-
export const sharedConfig: NgModule = {
11-
bootstrap: [ AppComponent ],
13+
@NgModule({
1214
declarations: [
1315
AppComponent,
1416
NavMenuComponent,
@@ -17,6 +19,9 @@ export const sharedConfig: NgModule = {
1719
HomeComponent
1820
],
1921
imports: [
22+
CommonModule,
23+
HttpModule,
24+
FormsModule,
2025
RouterModule.forRoot([
2126
{ path: '', redirectTo: 'home', pathMatch: 'full' },
2227
{ path: 'home', component: HomeComponent },
@@ -25,4 +30,6 @@ export const sharedConfig: NgModule = {
2530
{ path: '**', redirectTo: 'home' }
2631
])
2732
]
28-
};
33+
})
34+
export class AppModuleShared {
35+
}

templates/AngularSpa/ClientApp/boot-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'reflect-metadata';
22
import 'zone.js';
33
import { enableProdMode } from '@angular/core';
44
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
5-
import { AppModule } from './app/app.module.client';
5+
import { AppModule } from './app/app.module.browser';
66

77
if (module['hot']) {
88
module['hot'].accept();

0 commit comments

Comments
 (0)