1
1
// #docregion
2
2
import { BrowserModule } from '@angular/platform-browser' ;
3
3
import { FormsModule } from '@angular/forms' ;
4
- import { XHRBackend } from '@angular/http' ;
5
- // import { appRouterProviders } from './app.routes';
4
+ import { HttpModule } from '@angular/http' ;
5
+
6
+ /* import { routing } from './app.routing';*/
6
7
import { LocationStrategy ,
7
8
HashLocationStrategy } from '@angular/common' ;
8
9
import { NgModule } from '@angular/core' ;
9
10
10
11
import { HeroData } from './hero-data' ;
11
- import { InMemoryBackendService ,
12
- SEED_DATA } from 'angular2-in-memory-web-api' ;
12
+ import { InMemoryWebApiModule } from 'angular2-in-memory-web-api' ;
13
+
13
14
14
15
import { AppComponent } from './app.component' ;
15
16
import { HeroBioComponent } from './hero-bio.component' ;
@@ -31,44 +32,43 @@ import { ParentFinderComponent,
31
32
BethComponent ,
32
33
BobComponent } from './parent-finder.component' ;
33
34
34
- const DIRECTIVES = [
35
+ const declarations = [
36
+ AppComponent ,
35
37
HeroBiosComponent , HeroBiosAndContactsComponent , HeroBioComponent ,
36
38
HeroesBaseComponent , SortedHeroesComponent ,
37
39
HeroOfTheMonthComponent , HeroContactComponent ,
38
40
HighlightDirective ,
39
41
ParentFinderComponent ,
40
- AppComponent
41
42
] ;
42
43
43
- const B_DIRECTIVES = [ BarryComponent , BethComponent , BobComponent ] ;
44
+ const a_components = [ AliceComponent , AlexComponent ] ;
45
+
46
+ const b_components = [ BarryComponent , BethComponent , BobComponent ] ;
44
47
45
- // #docregion C_DIRECTIVES
46
- const C_DIRECTIVES = [
48
+ const c_components = [
47
49
CarolComponent , ChrisComponent , CraigComponent ,
48
50
CathyComponent
49
51
] ;
50
- // #enddocregion C_DIRECTIVES
51
52
52
- // #docregion bootstrap
53
53
@NgModule ( {
54
- imports : [ BrowserModule , FormsModule ] ,
55
- declarations : [ ...DIRECTIVES ,
56
- ...B_DIRECTIVES ,
57
- ...C_DIRECTIVES ,
58
- AliceComponent ,
59
- AlexComponent ] ,
54
+ imports : [
55
+ BrowserModule ,
56
+ FormsModule ,
57
+ HttpModule ,
58
+ InMemoryWebApiModule . forRoot ( HeroData )
59
+ // routing TODO: add routes
60
+ ] ,
61
+ declarations : [
62
+ declarations ,
63
+ a_components ,
64
+ b_components ,
65
+ c_components ,
66
+ ] ,
60
67
bootstrap : [ AppComponent ] ,
68
+ // #docregion providers
61
69
providers : [
62
- // appRouterProviders, TODO: add routes
63
- { provide : LocationStrategy , useClass : HashLocationStrategy } ,
64
-
65
- { provide : XHRBackend , useClass : InMemoryBackendService } , // in-mem server
66
- { provide : SEED_DATA , useClass : HeroData } // in-mem server data
70
+ { provide : LocationStrategy , useClass : HashLocationStrategy }
67
71
]
72
+ // #enddocregion providers
68
73
} )
69
- export class AppModule {
70
- constructor ( ) {
71
- }
72
- }
73
- // #enddocregion bootstraps
74
-
74
+ export class AppModule { }
0 commit comments