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
		
	
	
		
			535 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			535 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:angular2/core.dart';
 | |
| 
 | |
| import 'backend_service.dart';
 | |
| import 'hero.dart';
 | |
| import 'logger_service.dart';
 | |
| 
 | |
| @Injectable()
 | |
| // #docregion class
 | |
| class HeroService {
 | |
|   final BackendService _backendService;
 | |
|   final Logger _logger;
 | |
|   final List<Hero> heroes = [];
 | |
| 
 | |
|   HeroService(this._logger, this._backendService);
 | |
| 
 | |
|   List<Hero> getHeroes() {
 | |
|     _backendService.getAll(Hero).then((heroes) {
 | |
|       _logger.log('Fetched ${heroes.length} heroes.');
 | |
|       this.heroes.addAll(heroes); // fill cache
 | |
|     });
 | |
|     return heroes;
 | |
|   }
 | |
| }
 |