Polymer querySelector working on DartVM but not in Chrome after compile

When you run this code from the main() method it is probably a timing issue.
You can try something like

import "package:polymer/polymer.dart";

main() {
  initPolymer().run(() {
    // code here works most of the time
    Polymer.onReady.then((e) {     
      // some things must wait until onReady callback is called
    });
  });
}

see also how to implement a main function in polymer apps

Leave a Comment