<select name="country" id="countries" ng-options="country.name for country in countries track by country.id" style="font-size:13px;" ng-model="sel_country"
ng-change="set(sel_country)" >
<option>--</option>
</select>
// countries object
$scope.countries = [{name: 'UNITED KINGDOM', id: 1 },{name: 'AUSTRIA', id: 2}];
Как показать опцию по умолчанию в поле выбора с помощью вышеуказанного кода?
Вариант-1: используйте value=""
в <option>
<select name="country" id="countries" ng-options="sel_country as country.name for country in countries track by country.id" style="font-size:13px;" ng-model="sel_country[0]"
ng-change="set(sel_country)" >
<option value="">-select-</option>
</select>
Вариант-2: используйте ng-init
с ng-model
<select ng-init="sel_country = countries[0]" name="country" id="countries" ng-options="sel_country as country.name for country in countries track by country.id" style="font-size:13px;" ng-model="sel_country"
ng-change="set(sel_country)" >
<option>-select-</option>
</select>
Я думаю, вы хотите иметь значение "-" в качестве значения по умолчанию.
изменение
<option>--</option>
в
<option value="">--</option>
<select name="country"
id="countries"
ng-options="country.name for country in countries track by country.id"
style="font-size:13px;"
ng-model="sel_country"
ng-change="set(sel_country)" >
<option value="" disabled selected>--</option>
</select>