Files
sdk/pkg/polymer_expressions/example/example.dart
T
jmesserly@google.com 360ea42322 Rename mdv -> template_binding, remove experiemntal apis from dart:html
essentially, we trade off reduce dart:html API surface area for more annoying usage of these APIs. Since Polymer hides most of this, I suspect it won't be too annoying in practice.

Sample usage:

    nodeBind(node).bind(...)

    templateBind(node).model = ...;

R=sigmund@google.com

Review URL: https://codereview.chromium.org//34453003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29057 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 02:11:49 +00:00

31 lines
991 B
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:html';
import 'package:logging/logging.dart';
import 'package:polymer_expressions/polymer_expressions.dart';
import 'package:template_binding/template_binding.dart' show templateBind;
import 'person.dart';
main() {
new Logger('polymer_expressions').onRecord.listen((LogRecord r) {
print("${r.loggerName} ${r.level} ${r.message}");
});
var john = new Person('John', 'Messerly', ['A', 'B', 'C']);
var justin = new Person('Justin', 'Fagnani', ['D', 'E', 'F']);
var globals = {
'uppercase': (String v) => v.toUpperCase(),
'people': [john, justin],
};
templateBind(querySelector('#test'))
..bindingDelegate = new PolymerExpressions(globals: globals)
..model = john;
templateBind(querySelector('#test2')).model = john;
}