The code has a few issues:
- The
ng-options
select the name, while theng-model
points to an object. Better usestreetType as streetType.name for streetType in streettypeMockData
to select the entire object. - In this case, the initial value will not be honoured because Angular will try to compare objects by reference; use
track by
.
The full <select>
should be:
<select class="form-control" ng-model="streetTypeSelected"
ng-options="streetType as streetType.name for streetType in streettypeMockData track by streetType.name">
See forked plunker.