我正在使用 ng-options 在我的 Angular 应用程序中打印表单的所有选项。我直接从我的数据库中获取值,它给了我一个国家列表:
<select ng-options="country.country for country in countries" ng-model="selectedCountry" ng-change="updateSelectedCountry(selectedCountry)" class="form-control">
在这里,当页面加载时,选择不显示任何内容,即没有占位符,而我想打印一个像“任何地方”这样的静态值,而不必将它添加到我的“国家”列表中。
我试过这个:
<select ng-options="country.country for country in countries" ng-model="selectedCountry" ng-change="updateSelectedCountry(selectedCountry)" class="form-control">
<option>Anywhere</option>
</select>
但它不工作
有谁知道如何解决这个问题?
谢谢