With the code below, there will be a “default” option shown in the dropdown list
<select ng-model="query.tag" ng-options="name as name for (name, data) in tags">
<option value="">default</option>
</select>
However, if you set the option value, e.g
<select ng-model="query.tag" ng-options="name as name for (name, data) in tags">
<option value="default">default</option>
</select>
there will be no “default” option in the dropdown list.
So now I fall back to
<select ng-model="query.tag">
<option value="default">default</option>
<option ng-repeat="(name, data) in tags">{{name}}</option>
</select>
It works.
p.s. What’s the difference between “<select ng-options ...>
” and “...<option ng-repeat ...>...
”?