I already searched lot of stuff but it doesn't help. I want my data from php to be like this :
$scope.places = [{name: 'John'},{name: 'Jane'}];
My problem is I dont know how to achieve this thing. Here'e my angularjs looks like:
$scope.getNames = function(){
$http.post('get',{}).then(function(response){
$scope.places = response.data;
});
};
$scope.getNames();
PHP
$sql = "SELECT * FROM tblplace";
$res = $con->query($sql);
while($row = mysqli_fetch_array($res)){
// code here.
}
HTML
<select class="form-control places">
<option value="empty">Select</option>
<option ng-repeat="place in places" value="{{place.name}}"> {{place.name}}</option>
</select>
How to do it? Thanks!