Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Typeahead not respecting placeholder text #591

Closed
brandonhall opened this issue Jun 29, 2013 · 0 comments
Closed

Typeahead not respecting placeholder text #591

brandonhall opened this issue Jun 29, 2013 · 0 comments

Comments

@brandonhall
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant