mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
In AngularSpa template, redefine app.module.shared as a real NgModule. Fixes #986.
This commit is contained in:
17
templates/AngularSpa/ClientApp/app/app.module.browser.ts
Normal file
17
templates/AngularSpa/ClientApp/app/app.module.browser.ts
Normal file
@@ -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 {
|
||||||
|
}
|
||||||
@@ -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 {
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ServerModule } from '@angular/platform-server';
|
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({
|
@NgModule({
|
||||||
bootstrap: sharedConfig.bootstrap,
|
bootstrap: [ AppComponent ],
|
||||||
declarations: sharedConfig.declarations,
|
|
||||||
imports: [
|
imports: [
|
||||||
ServerModule,
|
ServerModule,
|
||||||
...sharedConfig.imports
|
AppModuleShared
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import { NgModule } from '@angular/core';
|
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 { 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 { NavMenuComponent } from './components/navmenu/navmenu.component';
|
||||||
import { HomeComponent } from './components/home/home.component';
|
import { HomeComponent } from './components/home/home.component';
|
||||||
import { FetchDataComponent } from './components/fetchdata/fetchdata.component';
|
import { FetchDataComponent } from './components/fetchdata/fetchdata.component';
|
||||||
import { CounterComponent } from './components/counter/counter.component';
|
import { CounterComponent } from './components/counter/counter.component';
|
||||||
|
|
||||||
export const sharedConfig: NgModule = {
|
@NgModule({
|
||||||
bootstrap: [ AppComponent ],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
NavMenuComponent,
|
NavMenuComponent,
|
||||||
@@ -17,6 +19,9 @@ export const sharedConfig: NgModule = {
|
|||||||
HomeComponent
|
HomeComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
HttpModule,
|
||||||
|
FormsModule,
|
||||||
RouterModule.forRoot([
|
RouterModule.forRoot([
|
||||||
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
||||||
{ path: 'home', component: HomeComponent },
|
{ path: 'home', component: HomeComponent },
|
||||||
@@ -25,4 +30,6 @@ export const sharedConfig: NgModule = {
|
|||||||
{ path: '**', redirectTo: 'home' }
|
{ path: '**', redirectTo: 'home' }
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
};
|
})
|
||||||
|
export class AppModuleShared {
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
|||||||
import 'zone.js';
|
import 'zone.js';
|
||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppModule } from './app/app.module.client';
|
import { AppModule } from './app/app.module.browser';
|
||||||
|
|
||||||
if (module['hot']) {
|
if (module['hot']) {
|
||||||
module['hot'].accept();
|
module['hot'].accept();
|
||||||
|
|||||||
Reference in New Issue
Block a user