Reputation: 2599
I have the following objects and properties:
User - TitleID
- FirstName
- Surname
- EmailAddress
Titles - CodeID
- Description
The user's title should be preselected in a select element which also contains all the other Titles from the Titles.
Although I can get all the titles to display in the select box, I cannot get it to pre-select the correct (or indeed any) title from the select box when editing a user.
This is what I have so far:
<select ng-model="user.TitleID" ng-options="title.CodeID as title.Description for title in titles track by title.CodeID">
How do I go about getting the correct title preselected with this relational data?
Upvotes: 0
Views: 39
Reputation: 37520
There's a potential bug in Angular where track by
and as
don't work together in ngOptions
.
Remove the track by and it'll work...
Upvotes: 2