You could put that logic in your html as well, only render the results once
3 or more characters have been entered. Something like
<div ng-if="searchText && searchText.length > 2">
...results...
</div>
On Wednesday, February 18, 2015 at 4:36:10 PM UTC-6, Aimery Marsily wrote:
>
> Yes I think it's an alternative. My problem was that I needed to wait for
> the user to have enter at least 2 character. So what I ended up doing is
> creating a $scope.$watch('searchText', function(newVal, oldVal) {} for my
> input and in that if the user enter nothing I set a variable
> $scope.showResults to false and also if the user enter nothing it's false.
>
>
> Le mercredi 18 février 2015 23:28:54 UTC+1, Nicholas Smith a écrit :
>>
>> Could you just ng-hide your results until some text has been entered?
>>
>>
>> On Wednesday, February 18, 2015 at 6:34:19 AM UTC-6, Aimery Marsily wrote:
>>>
>>> Hi,
>>>
>>> I have a list of elements that I display in an ng-repeat. I read about
>>> filters but what I need is the opposite. So a filter reduce a list of
>>> items, what I want is to display nothing until the user enter something in
>>> my input field and then display the items. So it's more a search than a
>>> filter. I watched on the net but found only ressources for Filters.
>>>
>>> My last option if nothing built-in exists is to create a $watch and
>>> populate an other $scope element like $scope.filteredItems and then do a
>>> ng-repeat on that. But maybe I'm missing something, any ideas ?
>>>
>>> Thanks !
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.