| 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 main() { | |
| 9 | |
| 10 print(window.location.search); | |
| 11 var module = new Module() | |
| 12 ..type(TodoController) | |
| 13 ..type(PlaybackHttpBackendConfig); | |
| 14 | |
| 15 // If these is a query in the URL, use the server-backed | |
| 16 // TodoController. Otherwise, use the stored-data controller. | |
| 17 var query = window.location.search; | |
| 18 if (query.contains('?')) { | |
| 19 module.type(ServerController); | |
| 20 } else { | |
| 21 module.type(ServerController, implementedBy: NoServerController); | |
| 22 } | |
| 23 | |
| 24 if (query == '?record') { | |
| 25 print('Using recording HttpBackend'); | |
| 26 var wrapper = new HttpBackendWrapper(new HttpBackend()); | |
| 27 module.value(HttpBackendWrapper, new HttpBackendWrapper(new HttpBackend())); | |
| 28 module.type(HttpBackend, implementedBy: RecordingHttpBackend); | |
| 29 } | |
| 30 | |
| 31 if (query == '?playback') { | |
| 32 print('Using playback HttpBackend'); | |
| 33 module.type(HttpBackend, implementedBy: PlaybackHttpBackend); | |
| 34 } | |
| 35 | |
| 36 ngBootstrap(module:module); | |
| 37 } | |
| OLD | NEW |