Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example of two way databinding in dart with polymer.dart

I see examples of one way data binding with the {{my_var}} format but, I do not see a way to bind the change from the HTML side back to the dart object. For example an input box text changing.

like image 510
Tim Avatar asked Jan 25 '26 18:01

Tim


1 Answers

There are several examples on Seth Ladd's GitHub space.

Here is a concrete example for a text input binding:

<polymer-element name="my-example">
  <template>
    <div>
      Type something: <input type="text" value="{{message}}">
    </div>
    <div>
      You typed {{message}}
    </div>
  </template>
  <script type="application/dart" src="my_example.dart"></script>
</polymer-element>



import 'package:polymer/polymer.dart';

@CustomTag('my-example')
class MyExample extends PolymerElement with ObservableMixin {
  @observable String message;
}
like image 56
Christophe Herreman Avatar answered Jan 28 '26 00:01

Christophe Herreman