Skip to content

Commit ae2941c

Browse files
author
Sam Storie
committed
Updates to use RC5 and start working with modules (not working yet!)
1 parent 7c086a8 commit ae2941c

File tree

4 files changed

+41
-15
lines changed

4 files changed

+41
-15
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { NgModule, provide } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
4+
import { AppComponent } from './app.component';
5+
6+
export function buildAppModule(apiUrl: string, apiToken: string) {
7+
8+
@NgModule({
9+
imports: [ BrowserModule ],
10+
providers: [provide("api.config", { useValue: { apiUrl: apiUrl, apiToken: apiToken} })],
11+
declarations: [ AppComponent ],
12+
bootstrap: [ AppComponent ]
13+
})
14+
export class AppModule { }
15+
16+
}

angular2-bootstrap-arguments-webpack/app/main.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import "es6-shim";
44
import "zone.js/dist/zone";
55
import "reflect-metadata";
66

7-
import { bootstrap } from '@angular/platform-browser-dynamic';
8-
import { provide } from "@angular/core";
7+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
8+
import { provide, CompilerOptions } from "@angular/core";
99

10-
import {AppComponent} from './app.component';
10+
//import {AppComponent} from './app.component';
11+
import {AppModule} from "./app.module";
1112
import {ApiConfig} from "./api.service";
1213

1314
// Expose the exports from the 'main' module into the global scope
@@ -34,8 +35,15 @@ export function RunApplication(apiUrl: string, apiToken: string) {
3435
// set up as well. Just create is as an injectable token here
3536
// so other components/services can consume it.
3637
//
37-
bootstrap(AppComponent, [
38-
provide("api.config", { useValue: apiConfig })
39-
])
40-
.catch(err => console.error(err));
38+
// bootstrap(AppComponent, [
39+
// provide("api.config", { useValue: apiConfig })
40+
// ])
41+
// .catch(err => console.error(err));
42+
43+
platformBrowserDynamic().bootstrapModule(AppModule, {
44+
providers: [
45+
provide("api.config", { useValue: apiConfig })
46+
]
47+
} as CompilerOptions);
48+
4149
}

angular2-bootstrap-arguments-webpack/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
},
1212
"license": "MIT",
1313
"dependencies": {
14-
"@angular/common": "^2.0.0-rc.4",
15-
"@angular/compiler": "^2.0.0-rc.4",
16-
"@angular/core": "^2.0.0-rc.4",
17-
"@angular/http": "^2.0.0-rc.4",
18-
"@angular/platform-browser": "^2.0.0-rc.4",
19-
"@angular/platform-browser-dynamic": "^2.0.0-rc.4",
14+
"@angular/common": "^2.0.0-rc.5",
15+
"@angular/compiler": "^2.0.0-rc.5",
16+
"@angular/core": "^2.0.0-rc.5",
17+
"@angular/platform-browser": "^2.0.0-rc.5",
18+
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
2019
"es6-shim": "^0.35.1",
21-
"reflect-metadata": "^0.1.3",
20+
"reflect-metadata": "^0.1.8",
2221
"rxjs": "5.0.0-beta.6",
2322
"zone.js": "^0.6.12"
2423
},

angular2-bootstrap-arguments-webpack/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@
99
"removeComments": false,
1010
"noImplicitAny": true,
1111
"suppressImplicitAnyIndexErrors": true
12-
}
12+
},
13+
"files": [
14+
"app/main.ts"
15+
]
1316
}

0 commit comments

Comments
 (0)