friedger
friedger

Reputation: 645

How to use apps-global with polymer's sampler-scaffold?

I am using sample-scaffold from https://github.com/Polymer/sampler-scaffold and define some globale variables using app-globals as described in https://www.polymer-project.org/docs/polymer/polymer.html#global

like

<app-globals myvar="value"></app-globals>
<sampler-scaffold>
  <core-item label="Page 1" url="page1.html"></core-item>
</sampler-scaffold>

page1.html contains also the app-globals without values.

<app-globals id="globals"></app-globals>

However, the globals element does not contain any values. Is there a way to define globals across iframes using app-globals?

Upvotes: 1

Views: 210

Answers (1)

Lloyd
Lloyd

Reputation: 1403

What about using the Polymer Element extensions? and inheritance to keep the interface of the app-globals object static? My Plunker: http://embed.plnkr.co/uDPTVP/preview

app-config.html

<!-- per https://www.polymer-project.org/docs/polymer/polymer.html#extending-other-elements -->
<link rel="import" href="http://www.polymer-project.org/components/polymer/polymer.html">
<link rel="import" href="app-globals.html">
<polymer-element name="app-config" extends="app-globals">
  <script>
    Polymer({
      ready: function () {
        this.super();

        this.values.GloabalSettingsVal1 = "GDG FTW"

      }
    });
  </script>
</polymer-element>

Upvotes: 0

Related Questions