Dropdown values from online JSON


I have been trying to sync dropdown values from JSON which I hosted online. But I couldn’t sync the values.

In controller.js

.controller(‘BusCtrl’, function($scope, $http) {

In HTML page

{{ x.name }}

What would be the reason ?


did you try $scope.$apply() ?

.controller('BusCtrl', function($scope, $http) {
$scope.$apply( function(){
$scope.cities = response;
}) ;


Do you have php header Access-Control-Allow-Origin in your city.php file? Without it, php can’t pass data to outside sources.


Thanks… It worked . I updated php file


You’re welcome! Glad it worked