| OLD | NEW |
| 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 import 'dart:html'; | 5 import 'dart:html'; |
| 6 | 6 |
| 7 import 'package:logging/logging.dart'; | 7 import 'package:logging/logging.dart'; |
| 8 import 'package:mdv/mdv.dart' as mdv; | |
| 9 import 'package:polymer_expressions/polymer_expressions.dart'; | 8 import 'package:polymer_expressions/polymer_expressions.dart'; |
| 9 import 'package:template_binding/template_binding.dart' show templateBind; |
| 10 | 10 |
| 11 import 'person.dart'; | 11 import 'person.dart'; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 mdv.initialize(); | |
| 15 new Logger('polymer_expressions').onRecord.listen((LogRecord r) { | 14 new Logger('polymer_expressions').onRecord.listen((LogRecord r) { |
| 16 print("${r.loggerName} ${r.level} ${r.message}"); | 15 print("${r.loggerName} ${r.level} ${r.message}"); |
| 17 }); | 16 }); |
| 18 | 17 |
| 19 var john = new Person('John', 'Messerly', ['A', 'B', 'C']); | 18 var john = new Person('John', 'Messerly', ['A', 'B', 'C']); |
| 20 var justin = new Person('Justin', 'Fagnani', ['D', 'E', 'F']); | 19 var justin = new Person('Justin', 'Fagnani', ['D', 'E', 'F']); |
| 21 var globals = { | 20 var globals = { |
| 22 'uppercase': (String v) => v.toUpperCase(), | 21 'uppercase': (String v) => v.toUpperCase(), |
| 23 'people': [john, justin], | 22 'people': [john, justin], |
| 24 }; | 23 }; |
| 25 | 24 |
| 26 query('#test') | 25 templateBind(querySelector('#test')) |
| 27 ..bindingDelegate = new PolymerExpressions(globals: globals) | 26 ..bindingDelegate = new PolymerExpressions(globals: globals) |
| 28 ..model = john; | 27 ..model = john; |
| 29 | 28 |
| 30 query('#test2').model = john; | 29 templateBind(querySelector('#test2')).model = john; |
| 31 } | 30 } |
| OLD | NEW |