I'm trying to add autocomlete by typeahead to my project, but now it shows in the Dropdown [object Object]. Where am I wrong?
$scope.getUsers = function () {
$scope.searchRequest = "/listaccounts.php?name=" + $scope.asyncSelected;
console.log($scope.searchRequest);
return $http.get($scope.searchRequest).then(function (response) {
$scope.searchResults = response.data;
return $scope.searchResults.records;
});
};
<input type="text" ng-model="asyncSelected" ng-change="asyncSelected = asyncSelected.toLowerCase()" name="user" class="form-control" aria-describedby="basic-addon1" autocomplete="off" uib-typeahead="name for name in getUsers($viewValue)">
JSON looks like:
{"records":[{"name":"q2q23w"},{"name":"qantheman"},{"name":"qee"},{"name":"qit"},{"name":"qiwi"}]}
I need to show in the dropdown only names.
uib-typeahead="user as user.name for user in getUsers($viewValue)"