Reputation: 9264
I want to read the contents of a paper-input
after pressing a button in Dart. I've tried other suggestions such as reading value
and inputValue
attributes on both the paper-element
and the internal html <input>.
Searching the page source doesn't reveal what is in the paper-input
. I found the contents inside of a private member of the inner html <input>, but I'm not sure if using Mirrors in Dart can reflect private members.
The relevant value
attribute resides at:
paper-element -> inner html <input> -> attributes map ->
private variable named _element
So the attributes map instance has some members that are not part of the map. Its _element
member has a value
uh field which contains the text residing in the paper-input
.
Tell me I'm missing something.
EDIT: Here is what ended up being the solution: Instance of Paper elements in dart
Upvotes: 1
Views: 1005
Reputation: 657308
I tried it yesterday and it worked mostly with inputValue
(while editing) and value
after leaving the input element using the tab key.
Ensure you are using the latest Polymer element.
dependencies: polymer: ">=0.12.0-dev <0.13.0"
(A special dependency constraint is necessary to get development releases of dependencies)
When accessing the value like
($['my-input'] as PaperInput).value // or .inputValue
returned the old value, but
<paper-input value='{{value}}' inputValue='{{inputValue}}` placeholder='enter text here></inputValue>
@observable String value;
@observable String inputValue;
worked
Upvotes: 3