@@ -59,7 +59,7 @@ block http-providers
59
59
So we register them in the `imports` array of `app.module.ts` where we
60
60
bootstrap the application and its root `AppComponent`.
61
61
62
- + makeExcerpt( 'app/app.module.ts (v1)' )
62
+ + makeExample( 'app/app.module.ts' , 'v1' , 'app/app.module.ts (v1)' )
63
63
64
64
:marked
65
65
Notice that we supply `!{_HttpModule}` as part of the *imports* !{_array} in root NgModule `AppModule`.
@@ -88,10 +88,16 @@ block http-providers
88
88
89
89
block backend
90
90
:marked
91
- We're replacing the default `XHRBackend`, the service that talks to the remote server,
92
- with the in-memory web API service after priming it as follows:
91
+ We're importing the `InMemoryWebApiModule` and adding it to the module `imports`.
92
+ The `InMemoryWebApiModule` replaces the default `Http` client backend —
93
+ the supporting service that talks to the remote server —
94
+ with an _in-memory web API alternative service_.
95
+ + makeExcerpt(_appModuleTsVsMainTs, 'in-mem-web-api' , '' )
96
+ :marked
97
+ The `forRoot` configuration method takes an `InMemoryDataService` class
98
+ that will prime the in-memory database as follows:
93
99
94
- + makeExample('app/in-memory-data.service.ts' , 'init' )
100
+ + makeExample('app/in-memory-data.service.ts' , 'init' )( format = '.' )
95
101
96
102
p This file replaces the #[ code #[ + adjExPath('mock-heroes.ts' )] ] which is now safe to delete.
97
103
@@ -500,24 +506,25 @@ block observable-transformers
500
506
We take a different approach in this example.
501
507
We combine all of the RxJS `Observable` extensions that _our entire app_ requires into a single RxJS imports file.
502
508
503
- + makeExample('app/rxjs-extensions.ts' )
509
+ + makeExample('app/rxjs-extensions.ts' )( format = '.' )
504
510
505
511
:marked
506
512
We load them all at once by importing `rxjs-extensions` in `AppComponent`.
507
513
508
- + makeExcerpt('app/app.component.ts' , 'rxjs-extensions' )
514
+ + makeExcerpt('app/app.component.ts' , 'rxjs-extensions' )( format = '.' )
509
515
510
516
:marked
511
517
### Add the search component to the dashboard
512
518
513
519
We add the hero search HTML element to the bottom of the `DashboardComponent` template.
514
520
515
- + makeExample('app/dashboard.component.html' )
521
+ + makeExample('app/dashboard.component.html' )( format = '.' )
516
522
517
523
- var _declarations = _docsFor == ' dart' ? ' directives' : ' declarations'
518
524
- var declFile = _docsFor == ' dart' ? ' app/dashboard.component.ts' : ' app/app.module.ts'
519
525
:marked
520
- And finally, we import the `HeroSearchComponent` and add it to the `!{_declarations}` !{_array}:
526
+ And finally, we import the `HeroSearchComponent` from `'./hero-search.component.ts'`
527
+ and add it to the `!{_declarations}` !{_array}:
521
528
522
529
+ makeExcerpt(declFile, 'search' )
523
530
0 commit comments