| OLD | NEW |
| 1 library todo; | 1 library todo; |
| 2 | 2 |
| 3 import 'package:angular/angular.dart'; | 3 import 'package:angular/angular.dart'; |
| 4 | 4 |
| 5 class Item { | 5 class Item { |
| 6 String text; | 6 String text; |
| 7 bool done; | 7 bool done; |
| 8 | 8 |
| 9 Item([String this.text = '', bool this.done = false]); | 9 Item([String this.text = '', bool this.done = false]); |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 todo.items.add(new Item(d["text"], d["done"])); | 30 todo.items.add(new Item(d["text"], d["done"])); |
| 31 }); | 31 }); |
| 32 }); | 32 }); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 // An implementation of ServerController that does nothing. | 36 // An implementation of ServerController that does nothing. |
| 37 // Logic in main.dart determines which implementation we should | 37 // Logic in main.dart determines which implementation we should |
| 38 // use. | 38 // use. |
| 39 class NoServerController implements ServerController { | 39 class NoServerController implements ServerController { |
| 40 Http _http; | |
| 41 init(TodoController todo) { } | 40 init(TodoController todo) { } |
| 42 } | 41 } |
| 43 | 42 |
| 44 | 43 |
| 45 @NgDirective( | 44 @NgDirective( |
| 46 selector: '[todo-controller]', | 45 selector: '[todo-controller]', |
| 47 publishAs: 'todo' | 46 publishAs: 'todo' |
| 48 ) | 47 ) |
| 49 class TodoController { | 48 class TodoController { |
| 50 List<Item> items; | 49 List<Item> items; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 84 } |
| 86 | 85 |
| 87 String classFor(Item item) { | 86 String classFor(Item item) { |
| 88 return item.done ? 'done' : ''; | 87 return item.done ? 'done' : ''; |
| 89 } | 88 } |
| 90 | 89 |
| 91 int remaining() { | 90 int remaining() { |
| 92 return items.where((item) => !item.done).length; | 91 return items.where((item) => !item.done).length; |
| 93 } | 92 } |
| 94 } | 93 } |
| OLD | NEW |