I have a input "firstname" where I type letters and it gives all the letter matches via filter. Then when I select wanted match which is a button, it should be changing the value inside input as selected.
This works IF input field is empty, but when lets say, i'm searching all the ppl named "jake" and I type "j"-letter inside input; then I choose jake from the list.
Input still shows only the "j"-letter.
One input field where search happen. Input value should be overridden when new value is selected from the list. How to do this?
html:
<input type="text" id="firstName" class="form-control" ng-model="firstName" required />
<div>
<ul ng-repeat="event in events | letterSearch:firstName | unique: 'email'">
<li>
<button class="btn btn-sm" ng-click="fillForm(event.firstName)">{{event.firstName}} </button>
</li>
</ul>
</div>
js:
$scope.fillForm = function (firstN) {
$scope.firstName = firstN;
};
Thx beforehand =)