My users object looks as follows:
var users = {
1: 'John Doe',
7: 'Marry Match',
13: 'Lindsay Lohan'
};
With 1, 7 and 13 being the user ID's and the names... Well, being the names.
How can I, in ui-select , populate my dropdown with my users?
I've tried the following
<ui-select ng-model="selectedUser" theme='select2' title="Choose a user">
<ui-select-choices repeat="(id, name) in users | filter: $select.search">
<span ng-bind="name"></span>
</ui-select-choices>
</ui-select>
The github has an object-as-source-example , and describes the repeat string as:
person.key as (key, person) in peopleObj
With that in mind maybe try:
<ui-select ng-model="selectedUser" theme='select2' title="Choose a user">
<ui-select-choices repeat="name.id as (id, name) in users | filter $select.search">
<span ng-bind="name"></span>
</ui-select-choices>
</ui-select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.