r3plica
r3plica

Reputation: 13367

angularjs ng-options with angular-ui-select

Argh, this again. I have a list of objects:

var roles = [{
    id: 1,
    name: 'Administrator'
}];

I am using ng-options and I want to display the name and when selected, it should use the name, but there is a filter. I tried this:

role.name for role in (roleController.roles | filter: $select.search) track by role.id

But it is throwing an error. Does anyone know how to do this?

Upvotes: 0

Views: 323

Answers (1)

Ionut Botizan
Ionut Botizan

Reputation: 34

Try this

role.id as role.name for role in  (roleController.roles | filter: $select.search) track by role.id

Upvotes: 1

Related Questions