I've been using Angular-UI typeahead and it's been working fine, but I've noticed a strange behavior when I hit the backspace key - it gives the correct results.
For example, if I type
sector 4
The result is
Sector 1
Sector 2
Sector 4
Sector 5
However, when I press backspace, the correct result is shown as
Sector 4
Sector 42
Sector 42a
Sector 47
This is my HTML code:
<input class="location-input" ng-model="Constants.loc" typeahead="loc.title for loc in loc_getdat()" typeahead-min-length="1">
And here is my controller code:
$scope.loc_getdat = function() {
if ($scope.Constants.loc.length > 1) {
return $http.get('/api/v2/location_auto_suggest?loc=' + $scope.Constants.loc)
.then(function(response) {
return response.data.location_search
});
}
}
What am I doing wrong?