diff --git a/app/app.component.ts b/app/app.component.ts
index 73ec3c7..405b4e3 100644
--- a/app/app.component.ts
+++ b/app/app.component.ts
@@ -3,7 +3,6 @@ import { ROUTER_DIRECTIVES } from '@angular/router';
@Component({
directives: [ROUTER_DIRECTIVES],
- providers: [Location],
selector: 'my-app',
styles: [`h1 {
color: white;
@@ -21,4 +20,4 @@ export class AppComponent {
name: string = "Angular 2 on Express";
constructor() {}
-}
\ No newline at end of file
+}
diff --git a/app/app.module.ts b/app/app.module.ts
new file mode 100644
index 0000000..4d10acf
--- /dev/null
+++ b/app/app.module.ts
@@ -0,0 +1,21 @@
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+
+import { AppComponent } from './app.component';
+import { AboutComponent } from "./components/about/about.component";
+import { routing } from "./routes";
+import { HomeComponent } from "./components/home/home.component";
+
+@NgModule({
+ imports: [
+ BrowserModule,
+ routing
+ ],
+ declarations: [
+ AppComponent,
+ AboutComponent,
+ HomeComponent
+ ],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule { }
diff --git a/app/components/home/home.component.html b/app/components/home/home.component.html
index 1013afb..07cc697 100644
--- a/app/components/home/home.component.html
+++ b/app/components/home/home.component.html
@@ -1,5 +1,5 @@
Page: {{name}}
Response from server: /users
-{{ ( users | async)?.name }}
-{{ ( users | async)?.last }}
\ No newline at end of file
+{{ users?.name }}
+{{ users?.last }}
\ No newline at end of file
diff --git a/app/components/home/home.component.ts b/app/components/home/home.component.ts
index 68da00d..54b4bd8 100755
--- a/app/components/home/home.component.ts
+++ b/app/components/home/home.component.ts
@@ -12,6 +12,8 @@ export class HomeComponent {
users: {};
constructor(http: Http) {
- this.users = http.get("/users").map(data => data.json());
+ http.get("/users")
+ .map(data => data.json())
+ .subscribe((data) => this.users = data);
}
}
\ No newline at end of file
diff --git a/app/main.ts b/app/main.ts
index f9d4627..fecb4c6 100644
--- a/app/main.ts
+++ b/app/main.ts
@@ -1,10 +1,8 @@
-import { bootstrap } from '@angular/platform-browser-dynamic';
-import { Type } from '@angular/core';
import { HTTP_PROVIDERS } from "@angular/http";
-import { AppComponent } from './app.component'
-import { APP_ROUTER_PROVIDERS } from "./routes";
-bootstrap(AppComponent, [
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { AppModule } from './app.module';
+
+platformBrowserDynamic([
HTTP_PROVIDERS,
- APP_ROUTER_PROVIDERS
-]);
\ No newline at end of file
+]).bootstrapModule(AppModule);
diff --git a/app/routes.ts b/app/routes.ts
index 2511819..194669f 100644
--- a/app/routes.ts
+++ b/app/routes.ts
@@ -1,23 +1,11 @@
-import { provideRouter, RouterConfig } from '@angular/router';
-import { LocationStrategy, HashLocationStrategy } from "@angular/common";
-import { Type } from '@angular/core';
-
-import {ComponentResolver, SystemJsComponentResolver} from '@angular/core';
-import {RuntimeCompiler} from '@angular/compiler';
+import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './components/home/home.component';
import { AboutComponent } from './components/about/about.component';
-const routes: RouterConfig = [
- { path: '', component: HomeComponent, terminal: true },
- { path: 'about', component: AboutComponent }
+export const routes: Routes = [
+ { path: '', component: HomeComponent, terminal: true },
+ { path: 'about', component: AboutComponent }
];
-export const APP_ROUTER_PROVIDERS = [
- provideRouter(routes), {
- provide: ComponentResolver,
- useFactory: (compiler) => new SystemJsComponentResolver(compiler),
- deps: [RuntimeCompiler]
- },
- { provide: LocationStrategy, useClass: HashLocationStrategy }
-];
+export const routing = RouterModule.forRoot(routes, { useHash: true });
diff --git a/package.json b/package.json
index 4d069c8..7c1e03e 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,9 @@
"tsc:w": "tsc -w",
"typings": "typings install",
"bundle": "node bin/bundler.js",
- "bundle:prod": "node bin/bundler.js --prod"
+ "bundle:prod": "node bin/bundler.js --prod",
+ "ngc": "ngc -p ."
+
},
"dependencies": {
"body-parser": "~1.13.2",
@@ -19,25 +21,26 @@
"serve-favicon": "~2.3.0"
},
"devDependencies": {
- "@angular/common": "2.0.0-rc.3",
- "@angular/compiler": "2.0.0-rc.3",
- "@angular/core": "2.0.0-rc.3",
- "@angular/http": "2.0.0-rc.3",
- "@angular/platform-browser": "2.0.0-rc.3",
- "@angular/platform-browser-dynamic": "2.0.0-rc.3",
- "@angular/router": "^3.0.0-alpha.7",
+ "@angular/common": "2.0.0-rc.5",
+ "@angular/compiler": "2.0.0-rc.5",
+ "@angular/core": "2.0.0-rc.5",
+ "@angular/forms": "0.3.0",
+ "@angular/http": "2.0.0-rc.5",
+ "@angular/platform-browser": "2.0.0-rc.5",
+ "@angular/platform-browser-dynamic": "2.0.0-rc.5",
+ "@angular/router": "3.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.2",
- "@angular/upgrade": "2.0.0-rc.3",
- "systemjs": "0.19.27",
+ "@angular/upgrade": "2.0.0-rc.5",
+ "angular2-in-memory-web-api": "0.0.15",
+ "concurrently": "^2.0.0",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
- "zone.js": "^0.6.12",
- "angular2-in-memory-web-api": "0.0.12",
- "concurrently": "^2.0.0",
+ "systemjs": "0.19.27",
"systemjs-builder": "^0.15.17",
"typescript": "^1.8.10",
"typings": "^1.3.0",
- "yargs": "^4.7.1"
+ "yargs": "^4.7.1",
+ "zone.js": "^0.6.12"
}
}
diff --git a/public/index.html b/public/index.html
index 8b123e0..1f9c74f 100755
--- a/public/index.html
+++ b/public/index.html
@@ -12,6 +12,7 @@
-
+ <