JSFiddle - React, Tailwind, and code Playground
by New Journey
HTML
<td class="col-md-2" ng-repeat="add in company.addressList">
<select type="text" class="form-control caps-entry" ng-change="stateDistrictCall(add.state)" capitalize ng-model="add.state" > <option value="TRIPURA">TRIPURA</option> <option value="TELANGANA">TELANGANA</option> <option value="TAMIL NADU">TAMIL NADU</option> <option value="WEST BENGAL">WEST BENGAL</option>
</select> </td>
<td class="col-md-2" ng-repeat="add in company.addressList">
<select class="form-control caps-entry" capitalize ng-change="stateDistrictCall(add.state)" ng-init="add.district" ng-options="district.name as district.name for district in districtList" ng-model="add.district" >
</select>
</td>
JavaScript
$scope.stateUrl = "new/dist/";
$scope.stateDistrictCall = function(state) {
if (state) {
var finalStateUrl = $scope.stateUrl + state;
$http.get(finalStateUrl).then(function(result) {
var altArray = [{
id: 0,
"name": ""
}];
for (var i = 0; i < result.data.length; i++) {
altArray.push({
"id": i + 1,
"name": result.data[i].toUpperCase()
});
}
$scope.districtList = altArray;
}, function() {
$("#overlay").hide();
$scope.loading = false;
$scope.showMessage('Error fetching data.');
})
}
};