Reputation: 91
I send a client as a parameter to custom client-followup-detail (in home.html) and show their information in "client_followup_detail.html", but when I try to access the client attribute from "client_followup_detail.dart" exception occurs.
home.html
<template repeat="{{index in extraTabsIndex}}">
<template if="{{activeTab == index}}">
<div class="tab-pane fade in active">
<p>
<client-followup-detail client="{{clientSelect}}"></client-followup-detail>
</p>
</div>
</template>
client_followup_detail.html
<td>{{client.state}}</td>
<td>{{client.cellphone}}</td>
<td>{{client.lastContactDate}}</td>
client_followup_detail.dart
@published Client client;
ClientFollowupDetail.created() : super.created() {
eventBus = getInstanceEventBus();
print(client.names); // client null
}
error:
Exception: The null object does not have a getter 'names'.
NoSuchMethodError : method not found: 'names'
Receiver: null
Arguments: []
Upvotes: 1
Views: 121
Reputation: 178
The ClientFollowupDetail instance might not be fully initialized by polymer.
It may help to move your create
code into an override of ready
:
ready() {
super.ready();
eventBus = getInstanceEventBus();
print(client.names);
}
Upvotes: 3