In my ionic application i am using ion-autocomplete to load certain values from an api call. it works fine when user gives some input.but i am trying to preload all the data initially if user dont type anything. how can this be achieved?
here is my code.
view
<input ion-autocomplete type="text" ng-model="customer"
placeholder="Customers" ng-click="getCustomers('1',customers)"
items-method="getCustomers(query,customers)"
item-view-value-key="company_name" items-clicked-method="setUser(callback,customers)"
class="ion-autocomplete" />
controller
$scope.getCustomers = function (query, model) {
var url = $rootScope.basicurl + "customers/customerName?customers=" + query + "&" + $scope.customertype + "=1";
return $http.get(url, {
headers: {
APIKEY: $localStorage.get('API_KEY')
}
}).then(function (response) {
$scope.customerList = response.data;
return $scope.customerList;
});
i tried calling the controller function on ng-click even though the function gets called it wont give the autocomplete.
Please help. thanks