2016-06-28 13:12:49 -07:00
|
|
|
// #docplaster
|
2016-08-12 11:21:16 -07:00
|
|
|
// #docregion , v1, v2
|
2016-06-28 13:12:49 -07:00
|
|
|
import 'package:angular2/core.dart';
|
|
|
|
import 'package:angular2/platform/browser.dart';
|
|
|
|
import 'package:angular2_tour_of_heroes/app_component.dart';
|
|
|
|
// #enddocregion v1
|
|
|
|
import 'package:angular2_tour_of_heroes/in_memory_data_service.dart';
|
docs(toh-6): refactoring of 'add, edit, delete heroes' (#2170)
* docs(toh-6/dart): refactoring of 'add, edit, delete heroes'
Refactoring of "add, edit, delete heroes" section of toh-6 from one big
bottom-up step into small independent feature slices, where the user
achieves a "milesone" (i.e., can run the full app) after each feature
section. The section rewrite is shorter and offers a better UX.
Other simplifications:
- Error handling is consistent: in the hero service we log to the
console, everwhere else we just let errors bubble up.
- Hero service methods renamed based on function (create, update)
rather then lower-level implementation (post, put).
- @Output properties have been eliminated (since they weren't
explained).
E2E tests now pass on both the TS and Dart sides.
* docs(toh-6/ts): refactoring of 'add, edit, delete heroes'
Refactoring of "add, edit, delete heroes" section of toh-6 from one big
bottom-up step into small independent feature slices, where the user
achieves a "milesone" (i.e., can run the full app) after each feature
section. The section rewrite is shorter and offers a better UX.
Other simplifications:
- Error handling is consistent: in the hero service we log to the
console, everwhere else we just let errors bubble up.
- Hero service methods renamed based on function (create, update)
rather then lower-level implementation (post, put).
- @Output properties have been eliminated (since they weren't
explained).
E2E tests now pass on both the TS and Dart sides.
Post-Dart-review updates included.
* docs(toh-6): ward tweaks
2016-08-26 14:57:45 -07:00
|
|
|
import 'package:http/http.dart';
|
2016-06-28 13:12:49 -07:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
bootstrap(AppComponent,
|
2016-08-09 10:41:05 -07:00
|
|
|
[provide(Client, useClass: InMemoryDataService)]
|
|
|
|
// Using a real back end? Import browser_client.dart and change the above to
|
|
|
|
// [provide(Client, useFactory: () => new BrowserClient(), deps: [])]
|
|
|
|
);
|
2016-06-28 13:12:49 -07:00
|
|
|
}
|
2016-08-12 11:21:16 -07:00
|
|
|
// #enddocregion v2,
|
2016-06-28 13:12:49 -07:00
|
|
|
/*
|
|
|
|
// #docregion v1
|
|
|
|
import 'package:http/browser_client.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
bootstrap(AppComponent, [
|
|
|
|
provide(BrowserClient, useFactory: () => new BrowserClient(), deps: [])
|
|
|
|
]);
|
|
|
|
// Simplify bootstrap provider list to [BrowserClient]
|
|
|
|
// once there is a fix for:
|
2016-08-09 10:41:05 -07:00
|
|
|
// https://github.com/dart-lang/angular2/issues/37
|
2016-06-28 13:12:49 -07:00
|
|
|
}
|
|
|
|
// #enddocregion v1
|
|
|
|
*/
|