How to start filtering only when the length of querytext is equal to 2

后端 未结 2 1182
长发绾君心
长发绾君心 2021-01-12 03:09

How can I be able to start filtering only when the querytext\'s length is equal to 2?

I have this code and I do not know how to start filtering only when querytext.l

相关标签:
2条回答
  • 2021-01-12 04:00

    As suggested by @Daiwei, here is what I did:

    <input type="search" ng-model="querytext" ng-minlength="2">
    <ul>
        <li ng-repeat="value in filteredList | filter:querytext>{{value.Name}}</li>
    </ul>
    

    and it works!Thanks!

    0 讨论(0)
  • 2021-01-12 04:06

    Add ng-minlength="2" to <input> element.

    <input type="search" ng-model="querytext" ng-minlength="2" />
    <!--                                      ^^^^^^^^^^^^^^^^ -->
    
    0 讨论(0)
提交回复
热议问题