Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit ef2695d

Browse files
committed
post-review changes
1 parent dcd02b4 commit ef2695d

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

public/docs/_examples/toh-6/dart/web/main.dart

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@
33
// #docregion v1
44
import 'package:angular2/core.dart';
55
import 'package:angular2/platform/browser.dart';
6-
import 'package:http/http.dart';
76
import 'package:angular2_tour_of_heroes/app_component.dart';
87
// #enddocregion v1
8+
import 'package:http/http.dart';
99
import 'package:angular2_tour_of_heroes/in_memory_data_service.dart';
1010

1111
void main() {
12-
bootstrap(AppComponent, const [
13-
const Provider(Client, useClass: InMemoryDataService)
14-
]);
12+
bootstrap(AppComponent,
13+
const [const Provider(Client, useClass: InMemoryDataService)]);
1514
}
1615
// #enddocregion final
1716
/*
1817
// #docregion v1
18+
import 'package:http/browser_client.dart';
1919
2020
void main() {
21-
bootstrap(AppComponent, const [BrowserClient]);
21+
bootstrap(AppComponent, [
22+
provide(BrowserClient, useFactory: () => new BrowserClient(), deps: [])
23+
]);
24+
// Simplify bootstrap provider list to [BrowserClient]
25+
// once there is a fix for:
26+
// https://github.com/angular/angular/issues/9673
2227
}
2328
// #enddocregion v1
2429
*/

public/docs/dart/latest/tutorial/toh-pt6.jade

+16-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ block includes
55
- var _Http = 'BrowserClient';
66
- var _Angular_Http = 'Dart <code>BrowserClient</code>'
77
- 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'
99
- var _HTTP_PROVIDERS = 'BrowserClient'
1010
- var _JSON_stringify = 'JSON.encode'
1111

@@ -20,22 +20,23 @@ block start-server-and-watch
2020

2121
block http-library
2222
: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.
2525

2626
### Pubspec updates
2727

2828
We need to add a package dependency for the !{_Angular_http_library}.
2929

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.
3634

3735
Update `pubspec.yaml` to look like this (additions are highlighted):
3836

37+
[guide-http]: ../guide/server-communication.html#!#http-providers
38+
[ng2x]: https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer
39+
3940
- var stylePattern = { pnk: /(http.*|resolved_identifiers:|Browser.*|Client.*)/gm };
4041
+makeExcerpt('pubspec.yaml', 'additions', null, stylePattern)
4142

@@ -48,7 +49,7 @@ block backend
4849
We want to replace `BrowserClient`, the service that talks to the remote server,
4950
with the in-memory web API service.
5051
Our in-memory web API service, shown below, is implemented using the
51-
standard `http` library `MockClient` class.
52+
`http` library `MockClient` class.
5253
All `http` client implementations share a common `Client` interface, so
5354
we'll have our app use the `Client` type so that we can freely switch between
5455
implementations.
@@ -58,9 +59,9 @@ block dont-be-distracted-by-backend-subst
5859
5960
block get-heroes-details
6061
: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`).
6465

6566
block hero-detail-comp-extra-imports-and-vars
6667
//- N/A
@@ -70,7 +71,8 @@ block hero-detail-comp-updates
7071
### Edit in the *HeroDetailComponent*
7172

7273
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.
7476

7577
block hero-detail-comp-save-and-goback
7678
//- N/A

0 commit comments

Comments
 (0)