如何使用AngularJS在Select中将GUID设置为文本中的值和名称
我正在制作一个下拉列表,我需要在其中填写国家列表。我正在获取国家列表,并希望使用angularjs在select中将GUID设置为值,将国家名称设置为文本如何使用AngularJS在Select中将GUID设置为文本中的值和名称,angularjs,asp.net-mvc-5,Angularjs,Asp.net Mvc 5,我正在制作一个下拉列表,我需要在其中填写国家列表。我正在获取国家列表,并希望使用angularjs在select中将GUID设置为值,将国家名称设置为文本 <select class="form-control" data-placeholder="Country" ng-model="activeCustomer.associatedCountryID" ng-options="country.countryid as country.name for country in Count
<select class="form-control" data-placeholder="Country" ng-model="activeCustomer.associatedCountryID" ng-options="country.countryid as country.name for country in CountryList" required></select>
您可以在ng选项中创建自己的对象。这就是你的意思吗
<select class="form-control"
data-placeholder="Country"
ng-model="activeCustomer.associatedCountry"
ng-options="{ GUID: country.countryid, Text: country.name } as country.name for country in CountryList"
required>
</select>