我想根据用户从客户列表中选择客户端来显示客户端ID和国家/地区,我可以显示整个所选对象但不能显示所选客户端详细信息。
<label class="control-label red">Client</label>
{{selectedClient}}
<select class="form-control" ng-model="selectedClient">
<option ng-repeat="client in clients" value="{{client.id}}">{{client.name}}</option>
</select>
<a href="javascript:void(0)" data-toggle="modal" data-target="#addressModel"><i class="fa fa-map-marker"></i>
{{selectedClient.id}},{{selectedClient.address_info.country}}
</a>
此处selectedClient
会相应地从选择框中进行选择,但selectedClient.id
和selectedClient.address_info.country
即使拥有一些值也不会显示。
selectedClient的输出是,
{
"id": 127,
"payment_terms_id": null,
"name": "Shihabs company",
"note": null,
"created_by": 0,
"updated_by": null,
"deleted_by": null,
"created_at": "2015-03-09 10:32:31",
"updated_at": "2015-03-09 10:32:31",
"deleted_at": null,
"status": 1,
"payment_term": null,
"address_info": {
"id": 54,
"client_id": 127,
"street": null,
"city": null,
"pobox": null,
"country": null,
"phone": null,
"work_phone": null,
"mobile": null,
"email": null,
"website": null,
"billing_street": null,
"billing_city": null,
"billing_pobox": null,
"billing_country": null,
"billing_phone": null,
"billing_work_phone": null,
"billing_mobile": null,
"billing_email": null,
"shipping_street": null,
"shipping_city": null,
"shipping_pobox": null,
"shipping_country": null,
"shipping_phone": null,
"shipping_work_phone": null,
"shipping_mobile": null,
"shipping_email": null,
"created_by": null,
"updated_by": null,
"deleted_by": null,
"created_at": "2015-03-09 10:32:31",
"updated_at": "2015-03-09 10:32:31",
"deleted_at": null,
"status": 1
}
}
答案 0 :(得分:1)
尝试这种方式来绑定选择选项
<select ng-model="selectedClient" ng-options="client.name for client in
clients"></select>