Dart聚合物,访问脚本中的自定义属性返回null
我将客户机作为参数发送到自定义客户机followup detail(在home.html中)并在“client\u followup\u detail.html”中显示它们的信息,但当我尝试从“client\u followup\u detail.dart”访问客户机属性时,会发生异常 home.htmlDart聚合物,访问脚本中的自定义属性返回null,dart,dart-polymer,polymer,Dart,Dart Polymer,Polymer,我将客户机作为参数发送到自定义客户机followup detail(在home.html中)并在“client\u followup\u detail.html”中显示它们的信息,但当我尝试从“client\u followup\u detail.dart”访问客户机属性时,会发生异常 home.html client_followup_detail.html {{client.state} {{client.mobile} {{client.lastContactDate} 客户跟踪
client_followup_detail.html
{{client.state}
{{client.mobile}
{{client.lastContactDate}
客户跟踪详细信息。dart
@已发布的客户端;
ClientFollowupDetail.created():super.created(){
eventBus=getInstanceEventBus();
打印(client.names);//客户端为空
}
错误:
异常:null对象没有getter“names”。
NoSuchMethodError:找不到方法:“名称”
收件人:空
论点:[]
客户端FollowUpDetail实例可能未被polymer完全初始化
将create
代码移动到ready
的覆盖中可能会有所帮助:
ready() {
super.ready();
eventBus = getInstanceEventBus();
print(client.names);
}
有趣的部分可能是home.dart
clientSelect
从哪里来?你能试着把你的{{clientSelect}}
放在
标记之外,并检查它在你的页面上产生了什么输出(比如`{{clientSelect})。