erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
610 stars 83 forks source link

global element #32

Closed johnstonmatt closed 9 years ago

johnstonmatt commented 9 years ago

How should I go about including one instance of an element on all of my pages? Including it in the index (with app router) does not work (page does not load), and including it in the layout makes multiple instances.

johnstonmatt commented 9 years ago

My issue was related to having an improper element definition. It looked like this:

 <polymer-element name="my-element">

     <template class="breaksstuff">

         <template></template>

         <script>
          Polymer({});
         </script>

    </template>

</polymer-element>
erikringsmuth commented 9 years ago

Good to hear you figured it out. Polymer also has some documentation on creating a singleton-like element https://www.polymer-project.org/docs/polymer/polymer.html#global.

johnstonmatt commented 9 years ago

thank you for the tip, and for the great library! If there is a core-router on the way I hope its similar.