title: Access global variable inside polymer
body: <p>I need to access javascript variable inside Polymer object. Tried accessing that variable inside ready function but nothing comes.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;script src="components/webcomponentsjs/webcomponents-lite.js"&gt;&lt;/script&gt;
      &lt;link rel="import" href="elements/my-app.html"&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;my-app&gt;&lt;/my-app&gt;
      &lt;script&gt;
        var messages = []
        var messages_count = {{ messages|length }};
  
        {% for message in messages %}
            var message = "{{ message.text }}"
            messages.push(message)
        {% endfor %}
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Update: Added my-app html file </p>
  
  <pre><code>&lt;dom-module is="my-app"&gt;
     &lt;script&gt;
       Polymer({
         is: "my-app",
       })
     &lt;/script&gt;
  &lt;/dom-module&gt;
  </code></pre>
  
  <p>And How do I access the <code>messages</code> in <code>my-app</code> ?</p>