My select box currently is adding an empty option to the select options even though ng-init is selecting the correct option. The options are added after an ajax call.
<select
ng-model="search.zoneType"
ng-init="search.zoneType = 'RELOCATIONZONE'">
<option value="">All Zone Types</option>
<option
ng-repeat="(id, poly) in data.polygons | unique: 'model.zoneType'"
ng-selected="poly.model.zoneType == search.zoneType"
value="{{poly.model.zoneType}}">
{{::poly.model.zoneType}}
</option>
</select>
But not only does the select box has an empty option right from the start, it also creates an empty select box if the currently selected option becomes removed - probably because the model value isn't available in the options anymore.
How can I catch these problems?
If the option of the current model value isn't available, it should just default to the first option (or any other).