diff --git a/templates/AngularSpa/ClientApp/app/app.module.browser.ts b/templates/AngularSpa/ClientApp/app/app.module.browser.ts new file mode 100644 index 0000000..e3393ce --- /dev/null +++ b/templates/AngularSpa/ClientApp/app/app.module.browser.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { AppModuleShared } from './app.module.shared'; +import { AppComponent } from './components/app/app.component'; + +@NgModule({ + bootstrap: [ AppComponent ], + imports: [ + BrowserModule, + AppModuleShared + ], + providers: [ + { provide: 'ORIGIN_URL', useValue: location.origin } + ] +}) +export class AppModule { +} diff --git a/templates/AngularSpa/ClientApp/app/app.module.client.ts b/templates/AngularSpa/ClientApp/app/app.module.client.ts deleted file mode 100644 index ee77812..0000000 --- a/templates/AngularSpa/ClientApp/app/app.module.client.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { FormsModule } from '@angular/forms'; -import { HttpModule } from '@angular/http'; -import { sharedConfig } from './app.module.shared'; - -@NgModule({ - bootstrap: sharedConfig.bootstrap, - declarations: sharedConfig.declarations, - imports: [ - BrowserModule, - FormsModule, - HttpModule, - ...sharedConfig.imports - ], - providers: [ - { provide: 'ORIGIN_URL', useValue: location.origin } - ] -}) -export class AppModule { -} diff --git a/templates/AngularSpa/ClientApp/app/app.module.server.ts b/templates/AngularSpa/ClientApp/app/app.module.server.ts index f2b6eb4..0608381 100644 --- a/templates/AngularSpa/ClientApp/app/app.module.server.ts +++ b/templates/AngularSpa/ClientApp/app/app.module.server.ts @@ -1,13 +1,13 @@ import { NgModule } from '@angular/core'; import { ServerModule } from '@angular/platform-server'; -import { sharedConfig } from './app.module.shared'; +import { AppModuleShared } from './app.module.shared'; +import { AppComponent } from './components/app/app.component'; @NgModule({ - bootstrap: sharedConfig.bootstrap, - declarations: sharedConfig.declarations, + bootstrap: [ AppComponent ], imports: [ ServerModule, - ...sharedConfig.imports + AppModuleShared ] }) export class AppModule { diff --git a/templates/AngularSpa/ClientApp/app/app.module.shared.ts b/templates/AngularSpa/ClientApp/app/app.module.shared.ts index 1861501..70d0797 100644 --- a/templates/AngularSpa/ClientApp/app/app.module.shared.ts +++ b/templates/AngularSpa/ClientApp/app/app.module.shared.ts @@ -1,14 +1,16 @@ import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; -import { AppComponent } from './components/app/app.component' +import { AppComponent } from './components/app/app.component'; import { NavMenuComponent } from './components/navmenu/navmenu.component'; import { HomeComponent } from './components/home/home.component'; import { FetchDataComponent } from './components/fetchdata/fetchdata.component'; import { CounterComponent } from './components/counter/counter.component'; -export const sharedConfig: NgModule = { - bootstrap: [ AppComponent ], +@NgModule({ declarations: [ AppComponent, NavMenuComponent, @@ -17,6 +19,9 @@ export const sharedConfig: NgModule = { HomeComponent ], imports: [ + CommonModule, + HttpModule, + FormsModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, @@ -25,4 +30,6 @@ export const sharedConfig: NgModule = { { path: '**', redirectTo: 'home' } ]) ] -}; +}) +export class AppModuleShared { +} diff --git a/templates/AngularSpa/ClientApp/boot-client.ts b/templates/AngularSpa/ClientApp/boot-client.ts index 45c471c..f07d936 100644 --- a/templates/AngularSpa/ClientApp/boot-client.ts +++ b/templates/AngularSpa/ClientApp/boot-client.ts @@ -2,7 +2,7 @@ import 'reflect-metadata'; import 'zone.js'; import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module.client'; +import { AppModule } from './app/app.module.browser'; if (module['hot']) { module['hot'].accept();