How To Set The Value Property In AngularJS' ng-options
Here we explain how to Set The Value Property for ng-options.
In latest version of AngularJS, this can be achieved by using track by expression.
We can set the actual value for the value attribute of select element.
Lets consider one example here.


In the above example, the collection is ArrayData with two properties.
DisplayID and DisplayText. ArrayData is bind to the scope object ScopeObject.
Initially selected value is set to DisplayID = 2 by using SelectedData.
On the View side we use ng-option within select for showing the final result.
ng-options = " data.DisplayText for data in ScopeObject.ArrayData
track by data.DisplayID "
Here we have used the track by data.DisplayID.
By this way we can Set The Value Property for ng-options.