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

Side by Side Diff: dart/samples/third_party/todomvc/web/app.dart

Issue 66253002: Version 0.8.10.9 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library todomvc.web.app; 5 library todomvc.web.app;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 import 'model.dart'; 9 import 'model.dart';
10 10
11 @CustomTag('todo-app') 11 @CustomTag('todo-app')
12 class TodoApp extends PolymerElement { 12 class TodoApp extends PolymerElement {
13 @observable AppModel app; 13 @observable AppModel app;
14 bool get applyAuthorStyles => true; 14 bool get applyAuthorStyles => true;
15 15
16 factory TodoApp() => new Element.tag('TodoApp'); 16 factory TodoApp() => new Element.tag('TodoApp');
17 17
18 TodoApp.created() : super.created() { 18 TodoApp.created() : super.created() {
19 app = appModel; 19 app = appModel;
20 } 20 }
21 21
22 void addTodo(Event e) { 22 void addTodo(Event e) {
23 e.preventDefault(); // don't submit the form 23 e.preventDefault(); // don't submit the form
24 InputElement input = getShadowRoot('todo-app').query('#new-todo'); 24 InputElement input = getShadowRoot('todo-app').querySelector('#new-todo');
25 if (input.value == '') return; 25 if (input.value == '') return;
26 app.todos.add(new Todo(input.value)); 26 app.todos.add(new Todo(input.value));
27 input.value = ''; 27 input.value = '';
28 } 28 }
29 29
30 void clear() => app.clearDone(); 30 void clear() => app.clearDone();
31 } 31 }
OLDNEW
« no previous file with comments | « dart/samples/third_party/todomvc/test/markdone_test.dart ('k') | dart/samples/third_party/todomvc/web/editable_label.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698