My select dropdown is supposed to display the names of states. The data is being fetched from PHP and is also available in the controller JS file. However, the data is showing up as blank in the HTML. When I use console.log(), the fetched result from PHP shows the names of all the states in a table.
HTML:
<select class='form-control' name='state' id='state' ng-model='AddqueryArr.state' required='required' ng-change='getCity(AddqueryArr.state)'>
<option></option>
<option ng-repeat='state in State.json' value='{{state.id}}'>{{state.name}}</option>
</select>
JS:
servicePOST.send(appConstants.BASE_MS_URL + 'Activity/fetch-addquery.php?case=State').then(function(result) {
$scope.State=result;
console.log($scope.State);
});
PHP:
case "State":
$sql="select stateid,statename from state ";
$result = mysql_query($sql) or die(mysql_error());
$json_array=$obj->runQuery($result);
break;
Sample Output:
Console.log: