You just need to register the handleGroupsLoaded()
in the $scope
function GroupsCtrl($scope, $http) {
$scope.url = '/file.php';
$scope.images = [];
$scope.handleGroupsLoaded = function(data, status) {
console.log(data);
}
$scope.fetch = function () {
$http.post($scope.url).success($scope.handleGroupsLoaded);
}
$scope.fetch();
}