Function not returning values

Relatively new to creator, love everything so far!

I’m getting stuck on retrieving values from a function. Any help would be great!!

How to return the values from the function to the $

Heres the call:

    $scope.loadData = function(){  
                $ = res;
                console.log('Eindresultaat: '+$;

And heres the function itself:

         query: function(params){
            var deferred = $q.defer();
                if( > 0) ID = parseInt([].ID);
                console.log('serviceresultaat: ';
            return deferred.promise;