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

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

Issue 1058283006: Update pubspecs and dependencies to get pkgbuild tests working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/web/todo.css ('k') | third_party/pkg/angular/demo/todo/webserver.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/angular/demo/todo/web/todo.dart
diff --git a/third_party/pkg/angular/demo/todo/web/todo.dart b/third_party/pkg/angular/demo/todo/web/todo.dart
deleted file mode 100644
index 289500a823b82ca359f41ae22df5d9e395ea88b9..0000000000000000000000000000000000000000
--- a/third_party/pkg/angular/demo/todo/web/todo.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-library todo;
-
-import 'package:angular/angular.dart';
-
-
-class Item {
- String text;
- bool done;
-
- Item([this.text = '', this.done = false]);
-
- bool get isEmpty => text.isEmpty;
-
- Item clone() => new Item(text, done);
-
- void clear() {
- text = '';
- done = false;
- }
-}
-
-
-// ServerController interface. Logic in main.dart determines which
-// implementation we should use.
-abstract class ServerController {
- init(TodoController todo);
-}
-
-
-// An implementation of ServerController that does nothing.
-class NoServerController implements ServerController {
- init(TodoController todo) { }
-}
-
-
-// An implementation of ServerController that fetches items from
-// the server over HTTP.
-class HttpServerController implements ServerController {
- final Http _http;
- HttpServerController(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"]));
- });
- });
- }
-}
-
-
-@NgController(
- selector: '[todo-controller]',
- publishAs: 'todo')
-class TodoController {
- var items = <Item>[];
- 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) => key == 'newItem' ? newItem : null;
-
- void add() {
- if (newItem.isEmpty) return;
-
- items.add(newItem.clone());
- newItem.clear();
- }
-
- void markAllDone() {
- items.forEach((item) => item.done = true);
- }
-
- void archiveDone() {
- items.removeWhere((item) => item.done);
- }
-
- String classFor(Item item) => item.done ? 'done' : '';
-
- int remaining() => items.fold(0, (count, item) => count += item.done ? 0 : 1);
-}
« no previous file with comments | « third_party/pkg/angular/demo/todo/web/todo.css ('k') | third_party/pkg/angular/demo/todo/webserver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698