最近まで、以下に示すようにbindPropertyを使用するか、this questionのように使用できましたが、これは0.8.0で変更されています。 doSomethingの()が呼び出されます):観測可能なフィールドの変更にサブスクライブする方法
<polymer-element name="my-login" attributes="model">
<template>
<template if="{{"model.isLoggedIn}}">
...
</template>
</template>
<script type= ... ></script>
</polymer-element>
。
@CustomTag("my-login")
class MyLogin extends PolymerElement with ObservableMixin {
LoginModel model;
@override
inserted() {
void doSomething() {
...
}
logoutChangeSubscription = は、bindProperty(モデル、#isLoggedIn、()=>のdoSomething());
}
}
class Model extends Object with ObservableMixin {
@observable bool isLoggedIn = false;
}