Fedy2
Fedy2

Reputation: 3207

Access static field in polymer expression

It is possible to access static fields in dart polymer expression?

In my template I need to access some static value from a know class, how can I access it in polymer expression?

Upvotes: 1

Views: 143

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658077

I don't know of a way to access it directly. I think you need to create a getter to the Polymer element where you want to use the value.

You can also create a mixin that provides access to the static values.

Another solution is to create a component that provides access to the static values and use it like

<polymer-element name="xx-yy">
  <template>
    <my-const id="my-const"></my-const>
    <template if="{{$['my-const'].isDebug}}">
      some debug output
    </template>
  </template>
</polymer-element>

Upvotes: 1

Related Questions