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

Unified Diff: src/site/docs/tutorials/remove-elements/examples/todo_with_delete/todo_with_delete.dart

Issue 26542002: edit pass on T3,4,5, updated images (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: merging with master Created 7 years, 2 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
Index: src/site/docs/tutorials/remove-elements/examples/todo_with_delete/todo_with_delete.dart
diff --git a/src/site/docs/tutorials/remove-elements/examples/todo_with_delete/todo_with_delete.dart b/src/site/docs/tutorials/remove-elements/examples/todo_with_delete/todo_with_delete.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c68e233338837a5e69ca0b013e5108d3003ecd69
--- /dev/null
+++ b/src/site/docs/tutorials/remove-elements/examples/todo_with_delete/todo_with_delete.dart
@@ -0,0 +1,21 @@
+import 'dart:html';
+
+InputElement toDoInput;
+UListElement toDoList;
+ButtonElement deleteAll;
+
+void main() {
+ toDoInput = query('#to-do-input');
+ toDoList = query('#to-do-list');
+ toDoInput.onChange.listen(addToDoItem);
+ deleteAll = query('#delete-all');
+ deleteAll.onClick.listen((e) => toDoList.children.clear());
+}
+
+void addToDoItem(Event e) {
+ var newToDo = new LIElement();
+ newToDo.text = toDoInput.value;
+ newToDo.onClick.listen((e) => newToDo.remove());
+ toDoInput.value = '';
+ toDoList.children.add(newToDo);
+}

Powered by Google App Engine
This is Rietveld 408576698