Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: third_party/pkg/angular/demo/todo/todo.dart

Issue 148453003: Updating Angular version (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pkg/angular/demo/todo/todo.css ('k') | third_party/pkg/angular/demo/todo/web/bootstrap.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/angular/demo/todo/todo.dart
diff --git a/third_party/pkg/angular/demo/todo/todo.dart b/third_party/pkg/angular/demo/todo/todo.dart
deleted file mode 100644
index ff3db815c2bae7492766a716e0af7009f6d14d6b..0000000000000000000000000000000000000000
--- a/third_party/pkg/angular/demo/todo/todo.dart
+++ /dev/null
@@ -1,93 +0,0 @@
-library todo;
-
-import 'package:angular/angular.dart';
-
-class Item {
- String text;
- bool done;
-
- Item([String this.text = '', bool this.done = false]);
-
- bool get isEmpty => text.isEmpty;
-
- clone() => new Item(text, done);
-
- clear() {
- text = '';
- done = false;
- }
-}
-
-// In 'server mode', this class fetches items from the server.
-class ServerController {
- Http _http;
-
- ServerController(Http this._http);
-
- init(TodoController todo) {
- _http(method: 'GET', url: '/todos').then((HttpResponse data) {
- data.data.forEach((d) {
- todo.items.add(new Item(d["text"], d["done"]));
- });
- });
- }
-}
-
-// An implementation of ServerController that does nothing.
-// Logic in main.dart determines which implementation we should
-// use.
-class NoServerController implements ServerController {
- init(TodoController todo) { }
-}
-
-
-@NgDirective(
- selector: '[todo-controller]',
- publishAs: 'todo'
-)
-class TodoController {
- List<Item> items;
- Item newItem;
-
- TodoController(ServerController serverController) {
- newItem = new Item();
- items = [
- new Item('Write Angular in Dart', true),
- new Item('Write Dart in Angular'),
- new Item('Do something useful')
- ];
-
- serverController.init(this);
- }
-
- // workaround for https://github.com/angular/angular.dart/issues/37
- dynamic operator [](String key) {
- if (key == 'newItem') {
- return newItem;
- }
- return null;
- }
-
- add() {
- if (newItem.isEmpty) return;
-
- items.add(newItem.clone());
- newItem.clear();
- }
-
- markAllDone() {
- items.forEach((item) => item.done = true);
- }
-
- archiveDone() {
- items.removeWhere((item) => item.done);
- }
-
- String classFor(Item item) {
- return item.done ? 'done' : '';
- }
-
- int remaining() {
- return items.where((item) => !item.done).length;
- }
-}
« no previous file with comments | « third_party/pkg/angular/demo/todo/todo.css ('k') | third_party/pkg/angular/demo/todo/web/bootstrap.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698