| OLD | NEW |
| (Empty) | |
| 1 import 'package:di/di.dart'; |
| 2 import 'package:angular/angular.dart'; |
| 3 import 'package:angular/playback/playback_http.dart'; |
| 4 import 'todo.dart'; |
| 5 |
| 6 import 'dart:html'; |
| 7 |
| 8 // Everything in the 'todo' library should be preserved by MirrorsUsed. |
| 9 @MirrorsUsed( |
| 10 targets: const ['todo'], |
| 11 override: '*') |
| 12 import 'dart:mirrors'; |
| 13 |
| 14 main() { |
| 15 print(window.location.search); |
| 16 var module = new Module() |
| 17 ..type(TodoController) |
| 18 ..type(PlaybackHttpBackendConfig); |
| 19 |
| 20 // If these is a query in the URL, use the server-backed |
| 21 // TodoController. Otherwise, use the stored-data controller. |
| 22 var query = window.location.search; |
| 23 if (query.contains('?')) { |
| 24 module.type(ServerController, implementedBy: HttpServerController); |
| 25 } else { |
| 26 module.type(ServerController, implementedBy: NoServerController); |
| 27 } |
| 28 |
| 29 if (query == '?record') { |
| 30 print('Using recording HttpBackend'); |
| 31 var wrapper = new HttpBackendWrapper(new HttpBackend()); |
| 32 module.value(HttpBackendWrapper, new HttpBackendWrapper(new HttpBackend())); |
| 33 module.type(HttpBackend, implementedBy: RecordingHttpBackend); |
| 34 } |
| 35 |
| 36 if (query == '?playback') { |
| 37 print('Using playback HttpBackend'); |
| 38 module.type(HttpBackend, implementedBy: PlaybackHttpBackend); |
| 39 } |
| 40 |
| 41 ngBootstrap(module: module); |
| 42 } |
| OLD | NEW |