JSFiddle - React, Tailwind, and code Playground

by sathish panduga p

HTML

<div ng-controller="DemoCtrl" ng-app="main">
    
  <p>populate select options with ajax</p>
        
  <select ng-model="selectedCountry.countryId" ng-options="country.countryId as country.name for country in chooseCountries"></select>
    
    <span>Selected country id is {{selectedCountry.countryId}}</span>   
    
</div>

JavaScript

var app = angular.module('main', []);
app.controller('DemoCtrl', function ($scope) {

    $scope.chooseCountries=[
        {countryId : 1, name : "France - Mainland", desc: "some description" },
        {countryId : 2, name : "Gibraltar", desc: "some description"},
        {countryId : 3, name : "Malta", desc: "some description"}
    ];
    
    $scope.selectedCountry = angular.copy($scope.chooseCountries[0]);
});