var app = angular.module('app', []); app.controller('appCtrl', function($scope, $http) { lekerDolgozok($scope, $http); }); var lekerDolgozok = function($scope, $http) { $http.post('php/kuld.php') .then(function(response){ $scope.dolgozok = response.data; }); }