Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用AngularJS在Select中将GUID设置为文本中的值和名称_Angularjs_Asp.net Mvc 5 - Fatal编程技术网

如何使用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

我正在制作一个下拉列表,我需要在其中填写国家列表。我正在获取国家列表,并希望使用angularjs在select中将GUID设置为值,将国家名称设置为文本

 <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>