11// #docregion
22import { BrowserModule } from '@angular/platform-browser' ;
33import { 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';*/
77import { LocationStrategy ,
88 HashLocationStrategy } from '@angular/common' ;
99import { NgModule } from '@angular/core' ;
1010
1111import { 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+
1414
1515import { AppComponent } from './app.component' ;
1616import { HeroBioComponent } from './hero-bio.component' ;
@@ -32,47 +32,43 @@ import { ParentFinderComponent,
3232 BethComponent ,
3333 BobComponent } from './parent-finder.component' ;
3434
35- const DIRECTIVES = [
35+ const declarations = [
36+ AppComponent ,
3637 HeroBiosComponent , HeroBiosAndContactsComponent , HeroBioComponent ,
3738 HeroesBaseComponent , SortedHeroesComponent ,
3839 HeroOfTheMonthComponent , HeroContactComponent ,
3940 HighlightDirective ,
4041 ParentFinderComponent ,
41- AppComponent
4242] ;
4343
44- const B_DIRECTIVES = [ BarryComponent , BethComponent , BobComponent ] ;
44+ const a_components = [ AliceComponent , AlexComponent ] ;
45+
46+ const b_components = [ BarryComponent , BethComponent , BobComponent ] ;
4547
46- // #docregion C_DIRECTIVES
47- const C_DIRECTIVES = [
48+ const c_components = [
4849 CarolComponent , ChrisComponent , CraigComponent ,
4950 CathyComponent
5051] ;
51- // #enddocregion C_DIRECTIVES
5252
53- // #docregion bootstrap
5453@NgModule ( {
5554 imports : [
5655 BrowserModule ,
5756 FormsModule ,
57+ HttpModule ,
58+ InMemoryWebApiModule . forRoot ( HeroData )
5859 // routing TODO: add routes
5960 ] ,
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+ ] ,
6567 bootstrap : [ AppComponent ] ,
68+ // #docregion providers
6669 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 }
7271 ]
72+ // #enddocregion providers
7373} )
74- export class AppModule {
75- constructor ( ) {
76- }
77- }
78- // #enddocregion bootstraps
74+ export class AppModule { }
0 commit comments