This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.
Typeahead not respecting placeholder text #591
Closed
Description
I have a typeahead that is working fine but it's not respecting the placeholder text. The reason is because I have a space in my result text.
Here's an example...
<input type="text" id="clientSelected" ng-model="clientSelected" typeahead="client as (client.firstName + ' ' + client.lastName) for client in clients | filter:$viewValue" placeholder="Just start typing...">
The client names are listed as: John Doe, Jane Doe, etc.. so nothing out of the ordinary there. Here is the controller part responsible for populating clients.
$scope.$apply(function() {
// Result has come back from the server
$scope.clients = result;
// Doesn't fix the problem
$scope.clientSelected = '';
});
So, with this implementation my input always has a " " so the placeholder isn't shown and the initial value of ng-model="clientSelected" is a " ". The space in the typeahead between (client.firstName + ' ' + client.lastName) is the reason.
@pkozlowski-opensource asked me to post the issue over here in a response on StackOverflow.