$scope.restaurants variable is emty. how to pass data to $scope.restaurants?
FoodSearchControllers.controller('homeCtrl', ['$scope', '$http', function($scope, $http) {
//restoranai
$http.post('http://appdev.milasevicius.com/server/index.php', {
"query": "SELECT * FROM n01_restaurant"
}).success(function(data, status) {
$scope.restaurants = data;
}).error(function(data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
console.log($scope.restaurants);
}]);
Also, controller is called twice. Why is that?