1

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.

Community
  • 1
  • 1
Ed Evans
  • 178
  • 1
  • 7

1 Answers1

3

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

Roman
  • 2,145
  • 4
  • 26
  • 33
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567