Reputation: 1200
I have the following example:
main_app.dart
@PolymerRegister('main-app')
class MainApp extends PolymerElement {
@property
Tst superTst = new Tst()..field1 = "blablabla";
}
class Tst {
String field1;
}
main_app.html
<dom-module id="main-app">
<template>
Teste
<span>{{superTst.field1}}</span>
</template>
</dom-module>
But, the {{superTst.field1}}
does not result in text being shown!
How to access fields of the Dart objects in Polymer 1.0? (from new classes, different Map, List and primitive types)
Upvotes: 2
Views: 122
Reputation: 658067
The class must extend JsProxy
and each member that should be available from Polymer needs the @reflectable
annotation. Currently for a getter/setter pair, both need the @reflectable
annotation (fixed already but not released AFAIK)
class Tst extends JsProxy {
@reflectable String field1;
}
If you update the value of field1
use
set('superTst.field1', 'newValue');
to ensure bindings are updated.
Upvotes: 3