I want to make an ajax call in angularJS, JSON is loading but the data is not populating.
demoApp.controller('MainController', function($scope, GetData) {
$scope.data = null;
GetData.getDoctors(function(dataResponse) {
$scope.data = dataResponse;
});
});
demoApp.factory('GetData', function($http) {
var doctors = [];
this.getDoctors = function(callBack) {
$http({
method: 'GET',
url: 'json/location.json'
}).
success(function(data) {
callBack(data);
}).
error(function(data) {
alert("Error");
});
}
});
Even the Json file is not loading ..what is the error in the code?