I am looking to populate select option with values from a basic json array.
The example I have is a country select. Each country has an id element and a name plus other
You miss-typed the value
attribute, change it to country.countryId
.
Also, set ng-model
directive to a single countryId value (or array of country IDs) instead of the full object.
JS:
function DemoSelectCtrl($scope) {
$scope.selectedValue = 1;
$scope.chooseCountries=[
{countryId : 1, name : "France - Mainland", desc: "some description" },
{countryId : 3, name : "Gibraltar", desc: "some description"},
{countryId : 3, name : "Malta", desc: "some description"}
];
});