diff --git a/public/docs/_examples/server-communication/dart/example-config.json b/public/docs/_examples/server-communication/dart/example-config.json
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/public/docs/_examples/server-communication/dart/lib/app_component.dart b/public/docs/_examples/server-communication/dart/lib/app_component.dart
new file mode 100644
index 0000000000..55c91e6e4d
--- /dev/null
+++ b/public/docs/_examples/server-communication/dart/lib/app_component.dart
@@ -0,0 +1,31 @@
+// #docplaster
+// #docregion
+import "package:angular2/core.dart" show Component;
+
+import "toh/hero_list_component.dart" show HeroListComponent;
+import "wiki/wiki_component.dart" show WikiComponent;
+import "wiki/wiki_smart_component.dart" show WikiSmartComponent;
+
+@Component(
+ selector: "my-app",
+ template: '''
+
+
+
+ ''',
+ // #enddocregion
+ /*
+ // #docregion http-providers
+ providers: const [
+ // in-memory web api provider
+ const Provider(BrowserClient,
+ useFactory: HttpClientBackendServiceFactory, deps: const [])],
+ // #enddocregion http-providers
+ */
+ // #docregion
+ directives: const [
+ HeroListComponent,
+ WikiComponent,
+ WikiSmartComponent
+ ])
+class AppComponent {}
diff --git a/public/docs/_examples/server-communication/dart/lib/hero_data.dart b/public/docs/_examples/server-communication/dart/lib/hero_data.dart
index 50ec0fab1d..ae0480b98d 100644
--- a/public/docs/_examples/server-communication/dart/lib/hero_data.dart
+++ b/public/docs/_examples/server-communication/dart/lib/hero_data.dart
@@ -2,7 +2,7 @@
import 'package:http/browser_client.dart';
import 'package:http_in_memory_web_api/http_in_memory_web_api.dart';
-CreateDb createDb = () => {
+CreateDb _createDb = () => {
'heroes': [
{"id": "1", "name": "Windstorm"},
{"id": "2", "name": "Bombasto"},
@@ -12,4 +12,4 @@ CreateDb createDb = () => {
};
BrowserClient HttpClientBackendServiceFactory() =>
- new HttpClientInMemoryBackendService(createDb);
+ new HttpClientInMemoryBackendService(_createDb);
diff --git a/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.dart b/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.dart
index 58fe0bb40c..23e1d6e9d7 100644
--- a/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.dart
+++ b/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.dart
@@ -9,7 +9,7 @@ import 'hero_service.dart';
@Component(
selector: 'hero-list',
templateUrl: 'hero_list_component.html',
- styles: const ['.error {color:red;}'])
+ providers: const [HeroService])
// #docregion component
class HeroListComponent implements OnInit {
final HeroService _heroService;
diff --git a/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.html b/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.html
index 86e2deedd6..297ffaa6c6 100644
--- a/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.html
+++ b/public/docs/_examples/server-communication/dart/lib/toh/hero_list_component.html
@@ -1,4 +1,5 @@
+
Tour of Heroes
Heroes:
-
diff --git a/public/docs/_examples/server-communication/dart/lib/toh/hero_service.dart b/public/docs/_examples/server-communication/dart/lib/toh/hero_service.dart
index 1daedc2d8c..d8d602d2e7 100644
--- a/public/docs/_examples/server-communication/dart/lib/toh/hero_service.dart
+++ b/public/docs/_examples/server-communication/dart/lib/toh/hero_service.dart
@@ -15,7 +15,9 @@ class HeroService {
// #enddocregion endpoint, http-get
final BrowserClient _http;
+ // #docregion ctor
HeroService(this._http);
+ // #enddocregion ctor
// #docregion methods, error-handling, http-get
Future
> getHeroes() async {
@@ -57,6 +59,7 @@ class HeroService {
Exception _handleError(dynamic e) {
// In a real world app, we might use a remote logging infrastructure
+ // We'd also dig deeper into the error to get a better message
print(e); // log to console instead
return new Exception('Server error; cause: $e');
}
diff --git a/public/docs/_examples/server-communication/dart/lib/toh/toh_component.dart b/public/docs/_examples/server-communication/dart/lib/toh/toh_component.dart
deleted file mode 100644
index 9c752ed730..0000000000
--- a/public/docs/_examples/server-communication/dart/lib/toh/toh_component.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// #docplaster
-// #docregion
-import 'package:angular2/core.dart';
-import 'package:http/browser_client.dart';
-
-import 'hero_list_component.dart';
-import 'hero_service.dart';
-// #enddocregion
-// #docregion in-mem-web-api
-/* ... */
-import 'package:server_communication/hero_data.dart';
-// #docregion
-
-@Component(
- // #enddocregion in-mem-web-api
- selector: 'my-toh',
- // #docregion template
- template: '''
- Tour of Heroes
-
- ''',
- // #enddocregion template
- directives: const [HeroListComponent],
- // #enddocregion
- // #docregion in-mem-web-api
- /* ... */
- // #docregion
- providers: const [
- HeroService,
- // #enddocregion
- // in-memory web api providers
- const Provider(BrowserClient,
- useFactory: HttpClientBackendServiceFactory)
- // #docregion
- ])
-class TohComponent {}
diff --git a/public/docs/_examples/server-communication/dart/pubspec.yaml b/public/docs/_examples/server-communication/dart/pubspec.yaml
index 7d36077d67..60e431bf51 100644
--- a/public/docs/_examples/server-communication/dart/pubspec.yaml
+++ b/public/docs/_examples/server-communication/dart/pubspec.yaml
@@ -12,11 +12,15 @@ dependencies:
jsonpadding: ^0.1.0
stream_transformers: ^0.3.0+3
http_in_memory_web_api: ^0.0.1
+# #docregion transformers
transformers:
- angular2:
- platform_directives: 'package:angular2/common.dart#CORE_DIRECTIVES'
- platform_pipes: 'package:angular2/common.dart#COMMON_PIPES'
+ platform_directives:
+ - 'package:angular2/common.dart#CORE_DIRECTIVES'
+ platform_pipes:
+ - 'package:angular2/common.dart#COMMON_PIPES'
entry_points: 'web/main.dart'
resolved_identifiers:
BrowserClient: 'package:http/browser_client.dart'
- dart_to_js_script_rewriter
+# #enddocregion transformers
diff --git a/public/docs/_examples/server-communication/dart/web/index.html b/public/docs/_examples/server-communication/dart/web/index.html
index ff2918e0bd..fc365968c2 100644
--- a/public/docs/_examples/server-communication/dart/web/index.html
+++ b/public/docs/_examples/server-communication/dart/web/index.html
@@ -6,15 +6,14 @@
+
- ToH Loading...
- Wiki Loading...
- WikiSmart Loading...
+ Loading...