How can I get an instance of the paper-input element below?
HTML file:
<!DOCTYPE html> <html> <head> <!-- <script src='packages/web_components/platform.js'></script> not necessary anymore with Polymer >= 0.14.0 --> <script src='packages/web_components/dart_support.js'></script> <link rel='import' href='packages/paper_elements/paper_input.html'> <script src='packages/browser/dart.js'></script> </head> <body fullbleed unresolved> <paper-input id='subject' label='subject'></paper-input> <script type='application/dart' src='myscript.dart'></script> </body> </html>
myscript.dart:
import 'dart:html'; import 'package:polymer/polymer.dart'; import 'package:paper_elements/paper_input.dart'; export 'package:polymer/init.dart'; PaperInput _subject = querySelector('#subject'); // exception void main() { ... }
This throws an exception:
Breaking on exception: type 'HtmlElement' is not a subtype of type 'PaperInput'
Sending from HtmlElement to PaperInput does not work. Suggestions included the use of shadowRoot.querySelector('#subject'); and other shadowRoot customs, but where did they come from? If I add .shadowRoot.querySelector('paper-input') to the last line of myscript.dart, the element will be zero. Same result if I use identifier instead of tag name. The element itself is the top level for the html body, so it is not in any other shadowRoot.
Cannot get paper-input content without its PaperInput class. But there seems to be no way to drop him.
source share