0
votes

I have an index page that has its template set to dom-bind and have data binding on the page as well as the paper-menu selection/button. In my script I have this:

var app = document.querySelector('#app');

app.selected = 0;

from what I understand that should set the page to index 0, but it doesn't. My main content area is blank, and if I select the menu item it changes happily. Just not on load. Something I am missing?

1

1 Answers

0
votes

Polymer takes just a moment to load and bind everything. Luckily, there's an event you can hook into just for that!

var app = document.querySelector('#app');

app.addEventListener('dom-change', function() {
  app.selected = 0;
});

I'd take a look at the Polymer Starter Kit's app.js file for some more tips on getting your app up and running.