@@ -25,26 +25,26 @@ class Item {
25
25
26
26
// ServerController interface. Logic in main.dart determines which
27
27
// implementation we should use.
28
- abstract class ServerController {
29
- init (TodoController todo);
28
+ abstract class Server {
29
+ init (Todo todo);
30
30
}
31
31
32
32
33
33
// An implementation of ServerController that does nothing.
34
- @NgInjectableService ()
35
- class NoServerController implements ServerController {
36
- init (TodoController todo) { }
34
+ @Injectable ()
35
+ class NoOpServer implements Server {
36
+ init (Todo todo) { }
37
37
}
38
38
39
39
40
40
// An implementation of ServerController that fetches items from
41
41
// the server over HTTP.
42
- @NgInjectableService ()
43
- class HttpServerController implements ServerController {
42
+ @Injectable ()
43
+ class HttpServer implements Server {
44
44
final Http _http;
45
- HttpServerController (this ._http);
45
+ HttpServer (this ._http);
46
46
47
- init (TodoController todo) {
47
+ init (Todo todo) {
48
48
_http (method: 'GET' , url: '/todos' ).then ((HttpResponse data) {
49
49
data.data.forEach ((d) {
50
50
todo.items.add (new Item (d["text" ], d["done" ]));
@@ -54,14 +54,14 @@ class HttpServerController implements ServerController {
54
54
}
55
55
56
56
57
- @NgController (
57
+ @Controller (
58
58
selector: '[todo-controller]' ,
59
59
publishAs: 'todo' )
60
- class TodoController {
60
+ class Todo {
61
61
var items = < Item > [];
62
62
Item newItem;
63
63
64
- TodoController ( ServerController serverController) {
64
+ Todo ( Server serverController) {
65
65
newItem = new Item ();
66
66
items = [
67
67
new Item ('Write Angular in Dart' , true ),
@@ -95,16 +95,16 @@ class TodoController {
95
95
main () {
96
96
print (window.location.search);
97
97
var module = new Module ()
98
- ..type (TodoController )
98
+ ..type (Todo )
99
99
..type (PlaybackHttpBackendConfig );
100
100
101
101
// If these is a query in the URL, use the server-backed
102
102
// TodoController. Otherwise, use the stored-data controller.
103
103
var query = window.location.search;
104
104
if (query.contains ('?' )) {
105
- module.type (ServerController , implementedBy: HttpServerController );
105
+ module.type (Server , implementedBy: HttpServer );
106
106
} else {
107
- module.type (ServerController , implementedBy: NoServerController );
107
+ module.type (Server , implementedBy: NoOpServer );
108
108
}
109
109
110
110
if (query == '?record' ) {
0 commit comments