What I'm trying to do is autocomplete Angular material ( md-autocomplete ) with data dynamically retrieved from an AJAX call to my REST API. Unfortunately, I get only an indefinite progress bar instead of autocomplete elements, as you can see below.
Result

controller
$scope.customersSelect = {}; $scope.selectedItem = null; $scope.searchText = null; $scope.getCustomers = function (query) { selectsService.getCustomers(query).then(function (results) { $scope.customersSelect = results.data; console.log($scope.customersSelect); }, function(error) { alert(error.data.message); }); }
Service
var selectsServiceFactory = {}; _getCustomers = function (query) { return $http.get(serviceBase + 'api/selects/customers/' + query) .then(function(results) { return results; }); } selectsServiceFactory.getCustomers = _getCustomers; return selectsServiceFactory;
View
<md-autocomplete md-floating-label="Klient" autocomplete="off" flex="" md-search-text-change="getCustomers(searchText)" md-item-text="item" md-items="item in customersSelect" md-search-text="searchText" md-selected-item="machine.customerId" md-input-maxlength="100" md-input-minlength="2" md-input-name="machineOwner"> <md-item-template> <span md-highlight-text="searchText">{{item}}</span> </md-item-template>
I get data successfully from the API because I see that it is printed on the console.
source share