ChruS ChruS - 1 year ago 97
AngularJS Question

AngularJS ng-options with several fields

I have a collection of objects with user info.

"Id": "1",
"Firstname": "ABCDEF",
"Lastname": "GHIJK",
"Middlename": ""

In my select options I want to display two fields -
Firstname Lastname
. I don't get how to do it and how to bind it to

Answer Source

You can try this :

  ng-options="user.Id as user.Firstname + ' ' + user.Lastname for user in users">

More information here :