2016-08-12 11:21:16 -07:00
|
|
|
// #docplaster
|
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
|
|
|
// #docregion
|
|
|
|
// #docregion rxjs-extensions
|
|
|
|
import './rxjs-extensions';
|
|
|
|
// #enddocregion rxjs-extensions
|
|
|
|
|
|
|
|
// #docregion v1, v2
|
2016-08-17 20:28:22 -05:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
import { BrowserModule } from '@angular/platform-browser';
|
|
|
|
import { FormsModule } from '@angular/forms';
|
|
|
|
import { HttpModule } from '@angular/http';
|
2016-08-09 17:38:25 +01:00
|
|
|
|
2016-08-12 11:21:16 -07:00
|
|
|
// #enddocregion v1
|
2016-08-09 17:38:25 +01:00
|
|
|
// Imports for loading & configuring the in-memory web api
|
2016-08-17 20:28:22 -05:00
|
|
|
import { InMemoryWebApiModule } from 'angular2-in-memory-web-api';
|
|
|
|
import { InMemoryDataService } from './in-memory-data.service';
|
2016-08-09 17:38:25 +01:00
|
|
|
|
2016-08-12 11:21:16 -07:00
|
|
|
// #docregion v1
|
2016-08-17 20:28:22 -05:00
|
|
|
import { AppComponent } from './app.component';
|
2016-08-09 17:38:25 +01:00
|
|
|
import { DashboardComponent } from './dashboard.component';
|
2016-08-17 20:28:22 -05:00
|
|
|
import { HeroesComponent } from './heroes.component';
|
2016-08-09 17:38:25 +01:00
|
|
|
import { HeroDetailComponent } from './hero-detail.component';
|
2016-08-12 11:21:16 -07:00
|
|
|
import { HeroService } from './hero.service';
|
|
|
|
// #enddocregion v1, v2
|
2016-08-09 17:38:25 +01:00
|
|
|
import { HeroSearchComponent } from './hero-search.component';
|
2016-08-12 11:21:16 -07:00
|
|
|
// #docregion v1, v2
|
2016-08-17 20:28:22 -05:00
|
|
|
import { routing } from './app.routing';
|
2016-08-09 17:38:25 +01:00
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [
|
|
|
|
BrowserModule,
|
|
|
|
FormsModule,
|
2016-08-17 20:28:22 -05:00
|
|
|
HttpModule,
|
|
|
|
// #enddocregion v1
|
|
|
|
// #docregion in-mem-web-api
|
|
|
|
InMemoryWebApiModule.forRoot(InMemoryDataService),
|
|
|
|
// #enddocregion in-mem-web-api
|
|
|
|
// #docregion v1
|
|
|
|
routing
|
2016-08-09 17:38:25 +01:00
|
|
|
],
|
2016-08-12 11:21:16 -07:00
|
|
|
// #docregion search
|
2016-08-09 17:38:25 +01:00
|
|
|
declarations: [
|
|
|
|
AppComponent,
|
|
|
|
DashboardComponent,
|
|
|
|
HeroDetailComponent,
|
2016-08-17 20:28:22 -05:00
|
|
|
HeroesComponent,
|
|
|
|
// #enddocregion v1, v2
|
2016-08-09 17:38:25 +01:00
|
|
|
HeroSearchComponent
|
2016-08-17 20:28:22 -05:00
|
|
|
// #docregion v1, v2
|
2016-08-09 17:38:25 +01:00
|
|
|
],
|
2016-08-12 11:21:16 -07:00
|
|
|
// #enddocregion search
|
2016-08-09 17:38:25 +01:00
|
|
|
providers: [
|
|
|
|
HeroService,
|
|
|
|
],
|
|
|
|
bootstrap: [ AppComponent ]
|
|
|
|
})
|
|
|
|
export class AppModule {
|
|
|
|
}
|