feature(angular2spa): Angular 2.0, Universal 2.0, TS 2.0

This commit is contained in:
Mark Pieszak
2016-09-17 17:58:01 -04:00
parent bbc95e0ce2
commit 4b356f356b
18 changed files with 273 additions and 1166 deletions

View File

@@ -0,0 +1,55 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { UniversalModule } from 'angular2-universal';
import {
App,
Counter,
FetchData,
Home,
NavMenu
} from './components';
import { routes } from './routes';
/* NOTE :
This file and `main.browser.ts` are identical, at the moment(!)
By splitting these, you're able to create logic, imports, etc
that are "Platform" specific.
If you want your code to be completely Universal and don't need that
You can also just have 1 file, that is imported into both
* boot-client
* boot-server
*/
// ** Top-level NgModule "container" **
@NgModule({
// Root App Component
bootstrap: [ App ],
// Our Components
declarations: [
App, Counter, FetchData, Home, NavMenu
],
imports: [
// * NOTE: Needs to be your first import (!)
UniversalModule,
// ^ NodeModule, NodeHttpModule, NodeJsonpModule are included for server
// Your other imports can go here:
FormsModule,
// App Routing
RouterModule.forRoot(routes)
]
})
export class MainModule {
}