我在.html文件中有以下声明:
<paper-toggle-button
id = 'tglBtn'
on-change = '{{ address.sameAddress }}'
on-mouseout = '{{ onChangeToggleBtnHandler }}'>
</paper-toggle-button>
class Address extends Observable
{
@observable
bool sameAddress = false;
}
执行应用程序时,会显示以下堆栈跟踪:
Exception: Uncaught Error: type 'bool' is not a subtype of type 'Function' of 'f'.
Stack Trace:
#0 minArgs (package:smoke/src/common.dart:53:22)
#1 GeneratedObjectAccessorService.invoke (package:smoke/static.dart:131:24)
#2 invoke (package:smoke/smoke.dart:43:41)
#3 HtmlElement&Polymer.dispatchMethod (package:polymer/src/instance.dart:1054:19)
#4 BindingDelegate&PolymerEventBindings.getEventHandler.<anonymous closure> (package:polymer/src/events.dart:82:32)
#5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1020)
#6 _RootZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1049)
#7 BindingDelegate&PolymerEventBindings.prepareEventBinding.<anonymous closure>.<anonymou
似乎通过某种形式的javascript访问。
关闭&gt; (包:聚合物/ SRC / events.dart:101:67)
答案 0 :(得分:0)
on-Change
是一个事件。您只能将事件处理程序绑定到它,而不是属性。