Здесь я пытаюсь загрузить данные в dropdownList. Загрузка. Но почему по умолчанию он выбирает последнее значение из списка.Почему выпадающее меню выбирает последнее значение
Html
<div ng-controller="Part5Controller">
Country : <select ng-model="CountryID" ng-options="I.CountryID as I.CountryName for I in CountryList" ng-change="GetState()">
<option value="">Select Country</option>
</select>
</div>
controller.Js
app.controller('Part5Controller', function ($scope, servicemard) {
getCountrys();
function getCountrys() {
var xx = servicemard.getctrys();
xx.then(function (d) {
$scope.CountryList = d.data;
})
}
})
service.js
app.service('servicemard', function ($http) {
this.getctrys = function() {
return $http.get('/Jan/GetCountries')
}
})
Можете ли вы добавить ответ «Янв/GetCountries»? –