0

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?

1
  • Can you post the error that it is giving? Commented Dec 9, 2016 at 19:37

1 Answer 1

1

Try this

role.id as role.name for role in  (roleController.roles | filter: $select.search) track by role.id
Sign up to request clarification or add additional context in comments.

1 Comment

Please add some explanation of why this code helps the OP. This will help provide an answer future viewers can learn from. See How to Answer for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.