I'm writing a website using angular-material in which I use the auto-complete. Within this autocomplete (codepen here) there is a function which returns the searchresults from a local array of demo search-items which (simplified) looks like this:
function querySearch (query) {
    var results = query ? self.repos.filter( createFilterFor(query) ) : self.repos, deferred;
    return results;
}
I now want to edit this code so that I can query the server after typing each letter. So I wrote the angular code to query the server and return a promise, as instructed here:
function querySearch (query) {
    return $http.get('/ajax/user/search/' + query).then(function(data){
        console.log(data); // I've got the data here. All fine.
        return data.data;
    });
}
Unfortunately this doesn't really work; the server gets queried fine, but I see an empty list of suggestions as you can see below:

Does anybody know how I can solve this issue? All tips are welcome!
 
     
     
    