I am using Angular UI-Bootstrap's typeahead
<input type="text" name="recipient" id="recipient" placeholder="Friend's name or username"
autofocus="autofocus"
class="form-control"
ng-model="payment.recipient"
typeahead="friend.username for friend in friends | filter:$viewValue | limitTo:4"
typeahead-template-url="typeaheadTemplate.html"
typeahead-editable="false"
ng-required="true"/>
Each Friend object has the following structure:
{
name: friendship.name,
username: friendship.username,
picture: friendship.picture // Url
}
It doesn't make sense to allow users to search by picture (it's a url to the avatar) and have had no success modifying the filter.
What I've tried:
typeahead="friend.username for friend in friends| filter:{username:username, name:name} | filter:$viewValue | limitTo:4"
typeahead="friend.username for friend in friends | filter:{username:$viewValue, name:$viewValue} | limitTo:4"
Using $viewValue
twice on the filter expression seems to break it... Any ideas?