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