I have the following HTML:
<input class="user" ng-model="user" />
<div class="matches">
<div class="match" ng-repeat="match in matches | filter:user" ng-bind="match"></div>
</div>
I only want to show .matches
IF you are typing and searching for a user
. Otherwise, I don't want to show the field. But the input
field is always displaying the user
(so I can't use the fact that the input is empty or not).
Is there a way I can use the fact that the input
is focused directly? Right now, I manually update a value ng-if="isFocused"
when you focus in and out.
<input type="text" ng-focus="focused = true" ng-blur="focused = false" />
<p ng-if="focused">focused!</p>
Plunker
check this
<input class="user" ng-model="user" />
<div class="matches">
<div class="match" ng-if="user!=''" ng-repeat="match in matches | filter:user" ng-bind="match"></div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With