仅当querytext的长度等于2时,如何才能开始过滤?
我有这段代码,我不知道如何仅在querytext.length> = 2时才开始过滤
<input type="search" ng-model="querytext"> <ul> <li ng-repeat="value in filteredList | filter:querytext>{{value.Name}}</li> </ul> $scope.filteredList =[{Id:1,Name:"Soul"},{Id:2,Name:"Croft"}];
添加ng-minlength="2"到<input>元素。
ng-minlength="2"
<input>
<input type="search" ng-model="querytext" ng-minlength="2" /> <!-- ^^^^^^^^^^^^^^^^ -->