2
votes

In dart I have to make the customized element communicate with main() function. As pointed out by an example in Dart-polymer-example (https://github.com/sethladd/dart-polymer-dart-examples/blob/master/web/custom_element_with_custom_attribute_binding/index.html), currently the binding dose not work.

<template id="tmpl" bind>
  <my-element value="{{value}}" id="test"></my-element>

  <!-- This should be updating, but it's not updating -->
  <!-- See http://code.google.com/p/dart/issues/detail?id=12440 -->
  <p>The model's value is {{value}}</p>
</template>

I tried several alternative manners, like "query("#test").attributes["value"]", they do not work. Is there any other method to try?

Thanks!

1

1 Answers

2
votes

Yes, I had a very similar problem! You can query the DOM and then get the xtag attribute to get the underlying Polymer object. So the example would be:

query("#test").xtag.value

See the documentation for more details:

https://www.dartlang.org/articles/web-ui/spec.html#retrieval