Also update dart_to_js_script_rewriter dependency to ^1.0.1, and change most angular2.dart imports to be core.dart instead. The pipes example broke without the angular2.dart import, so I let it be. The server-communication sample has never worked for me, so I changed it but might have broken it further. closes #1007
25 lines
646 B
Dart
25 lines
646 B
Dart
// #docregion
|
|
import 'package:angular2/core.dart';
|
|
|
|
import 'hero.dart';
|
|
import 'logger_service.dart';
|
|
|
|
@Injectable()
|
|
class BackendService {
|
|
final Logger _logger;
|
|
List getAll(type) {
|
|
// TODO get from the database and return as a promise
|
|
if (type == Hero) {
|
|
return [
|
|
new Hero('Windstorm', power: 'Weather mastery'),
|
|
new Hero('Mr. Nice', power: 'Killing them with kindness'),
|
|
new Hero('Magneta', power: 'Manipulates metalic objects')
|
|
];
|
|
}
|
|
_logger.error('Cannot get object of this type');
|
|
throw new ArgumentError("TODO: put log content here");
|
|
}
|
|
|
|
BackendService(Logger this._logger);
|
|
}
|