当前位置: 动力学知识库 > 问答 > 编程问答 >

Programmatic custom element broken in dart polymer 0.9.5?

问题描述:

The earlier solution for programmatic custom element creation in polymer 0.8.5 seems to be broken in polymer 0.9.5.

If we modify the standard click-counter example to use programmatic element creation, like so:

main() {

Logger.root.level = Level.ALL;

Logger.root.onRecord.listen((LogRecord rec) {

print('${rec.loggerName}: ${rec.level.name}: ${rec.time}: ${rec.message}');

});

initPolymer();

var clickCounter = new Element.tag('click-counter');

document.body.children.add(clickCounter);

}

the on-click events are correctly invoking the {{increment}} method, but the {{count}} value is not updated in the HTML.

网友答案:

Polymer code should be run from

import "package:polymer/polymer.dart";

main() {
  initPolymer().run(() {
    // code here works most of the time
    Polymer.onReady.then((value) {     
      // some things must wait until onReady callback is called
      // for an example look at the discussion linked below
    });
  });
}

simple tooltip working in dartium, not as javascript

分享给朋友:
您可能感兴趣的文章:
随机阅读: