closes #1807 - e2e tests now also cover the tax calculator. - Dart app updated to match TS (it had no sales tax calculator). - TS sample source cleanup (e.g. removed many unnecessary `docregions`). - Prose updated to include @kwalrath's revisions from a while ago, Ward's comments, and some of my edits as well. Contributes to #1598 and #1508.
24 lines
570 B
TypeScript
24 lines
570 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
import { Hero } from './hero';
|
|
import { BackendService } from './backend.service';
|
|
import { Logger } from './logger.service';
|
|
|
|
@Injectable()
|
|
// #docregion class
|
|
export class HeroService {
|
|
private heroes: Hero[] = [];
|
|
|
|
constructor(
|
|
private backend: BackendService,
|
|
private logger: Logger) { }
|
|
|
|
getHeroes() {
|
|
this.backend.getAll(Hero).then( (heroes: Hero[]) => {
|
|
this.logger.log(`Fetched ${heroes.length} heroes.`);
|
|
this.heroes.push(...heroes); // fill cache
|
|
});
|
|
return this.heroes;
|
|
}
|
|
}
|