我们在我们的应用程序中使用 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
如果我的问题不清楚,请告诉我。