@@ -5,7 +5,7 @@ block includes
5
5
- var _Http = ' BrowserClient' ;
6
6
- var _Angular_Http = ' Dart <code>BrowserClient</code>'
7
7
- var _httpUrl = ' https://pub.dartlang.org/packages/http'
8
- - var _Angular_http_library = ' Dart <a href="' + _httpUrl + ' "><b>http</b></a> library '
8
+ - var _Angular_http_library = ' Dart <a href="' + _httpUrl + ' "><b>http</b></a> package '
9
9
- var _HTTP_PROVIDERS = ' BrowserClient'
10
10
- var _JSON_stringify = ' JSON.encode'
11
11
@@ -20,22 +20,23 @@ block start-server-and-watch
20
20
21
21
block http-library
22
22
:marked
23
- We'll be using the !{_Angular_Http} to communicate with a server.
24
- This class is exported by the !{_Angular_http_library} .
23
+ We'll be using the !{_Angular_http_library}'s
24
+ `BrowserClient` class to communicate with a server .
25
25
26
26
### Pubspec updates
27
27
28
28
We need to add a package dependency for the !{_Angular_http_library}.
29
29
30
- We also need to inform the Dart Angular 2 Transformer that we will be using
31
- `BrowserClient` (we'll defer explaining _why_ this extra configuration is
32
- needed until the [HTTP client chapter](../guide/server-communication.html#!#http-providers))
33
- by means of the transformer's `resolved_identifiers` configuration parameter.
34
- Since we will also be needing the !{_Angular_http_library} `Client` interface, we'll
35
- add that now as well.
30
+ We also need to add a `resolved_identifiers` entry, to inform the [angular2
31
+ transformer][ng2x] that we'll be using `BrowserClient`. (For an explanation of why
32
+ this extra configuration is needed, see the [HTTP client chapter][guide-http].) We'll
33
+ also need to use `Client` from http, so let's add that now as well.
36
34
37
35
Update `pubspec.yaml` to look like this (additions are highlighted):
38
36
37
+ [guide-http]: ../guide/server-communication.html#!#http-providers
38
+ [ng2x]: https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer
39
+
39
40
- var stylePattern = { pnk: / (http. * | resolved_identifiers:| Browser. * | Client. * )/ gm };
40
41
+ makeExcerpt('pubspec.yaml' , 'additions' , null , stylePattern)
41
42
@@ -48,7 +49,7 @@ block backend
48
49
We want to replace `BrowserClient`, the service that talks to the remote server,
49
50
with the in-memory web API service.
50
51
Our in-memory web API service, shown below, is implemented using the
51
- standard `http` library `MockClient` class.
52
+ `http` library `MockClient` class.
52
53
All `http` client implementations share a common `Client` interface, so
53
54
we'll have our app use the `Client` type so that we can freely switch between
54
55
implementations.
@@ -58,9 +59,9 @@ block dont-be-distracted-by-backend-subst
58
59
59
60
block get-heroes-details
60
61
:marked
61
- We make an asynchronous call to `http.get()` which returns an HTTP
62
- `Response `. The response payload (`body`) is decoded as JSON via the
63
- `_extractData` helper method .
62
+ To get the list of heroes, we first make an asynchronous call to
63
+ `http.get() `. Then we use the `_extractData` helper method to decode the
64
+ response payload (`body`) .
64
65
65
66
block hero-detail-comp-extra-imports-and-vars
66
67
//- N/A
@@ -70,7 +71,8 @@ block hero-detail-comp-updates
70
71
### Edit in the *HeroDetailComponent*
71
72
72
73
We already have `HeroDetailComponent` for viewing details about a specific hero.
73
- Supporting edit functionality is natural extensions of the detail view, so we are able to reuse `HeroDetailComponent` with a few tweaks.
74
+ Supporting edit functionality is a natural extension of the detail view,
75
+ so we are able to reuse `HeroDetailComponent` with a few tweaks.
74
76
75
77
block hero-detail-comp-save-and-goback
76
78
//- N/A
0 commit comments