我正在制作一个下拉列表,我需要填写国家/地区列表。我正在获取country-list,并希望使用angularjs将GUID设置为value,将Country Name设置为text in。
<select class="form-control" data-placeholder="Country" ng-model="activeCustomer.associatedCountryID" ng-options="country.countryid as country.name for country in CountryList" required></select>
答案 0 :(得分:0)
您可以在ng-options中创建自己的对象。这是你的意思:
<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>