While appending the option values to select tag, an empty option tag is also getting appended using Angular JS. I couldn't figure it out why it adds so. Here is my JS code
// Create global countries array.
$scope.countries = [];
countryPromise.success(function(data, status, headers, config) {
for(index in data) {
console.log("ID:"+data[index].id+" Name:"+data[index].name);
$scope.countries.push({
id:data[index].id,
name:data[index].name
});
}
$scope.countrylist = $scope.countries;
My HTML
<select ng-model="country" ng-change="changeCountry()" ng-options="v.name for v in countrylist">
Output of console
ID:1 Name:India