我们正在使用ui-select作为我们应用程序中的输入框。请找到我们面临的以下问题。
<ui-select-choices repeat="user.firstname as user in users" refresh="pvm.peopleSuggest($event, $select.search, 'userId')" refresh-delay="200" >
<div>{{user.firstname}} {{ user.lastname}}</div>
</ui-select-choices>
在上面的html中,您可以看到我们需要一个对象的名字和姓氏来绑定到ng-model。我已经浏览了这个链接angular- ui-select - how to bind object property to ng-model,因为这个链接讲述了如何将单个属性绑定到对象,但我们需要多属性来绑定到ng-model。
这是我的json数据:
{
"p_err_code":"success",
"count":1,
"users": [
{"objectType":"user","user_id":"emea\\gaurapan","firstname":"Pandey","lastname":"Gaurav","designation":"External","status":"disabled","imagename":" ","type":"NONE"},
{"objectType":"user","user_id":"sdf\\sdf","firstname":"sdf","lastname":"rtrty","designation":"External","status":"disabled","imagename":" ","type":"NONE"},
]
}
这是我的样本json
如果我的问题不清楚,请告诉我。