dart-archive / polymer-dart

Polymer support for Dart
https://pub.dartlang.org/packages/polymer
BSD 3-Clause "New" or "Revised" License
181 stars 33 forks source link

Wrong documentation for read-only properties #685

Closed jolleekin closed 8 years ago

jolleekin commented 8 years ago

In wiki/properties#read-onlyproperties, the sample code is not correct. @Property(notify: true) must be used instead of @property.

@PolymerRegister('my-element')
class MyElement extends PolymerElement {
  MyElement.created() : super.created();

  @property
 // Should be @Property(notify: true)
  String get myValue => _myValue;
  String _myValue;

  @reflectable
  someEventHandler() {
    _myValue = 'hello!';
    notifyPath('myValue', _myValue);
  }
}
jakemac53 commented 8 years ago

Just @property should be correct. All that the notify: true option does is opt into two way binding (upwards, by firing my-value-changed events), which is a separate thing.