Thanks John. I know this answer is like 2 years old but definitely 
appreciated.

On Sunday, November 3, 2013 at 2:58:45 PM UTC-5, John Duane wrote:
>
> Here is another way that should not re-execute the filter function:
>
> <input ng-model="query" name="query">
> store the filter results in filteredData:
> <ul>
>   <li ng-repeat="todo in filteredData = (todos | 
> filter:query">{{todo}})"</li>
> </ul>
> then check filteredData's length to conditionally show a warning:
> <p ng-show="filteredData.length==0">There are no todos for given query</p>
>
> Hope it helps,
> John.
>
> On Tuesday, July 3, 2012 8:24:46 AM UTC-6, Jakub Arnold wrote:
>>
>> I have a list created via *ng-repeat* with a *filter:query* and I want 
>> to be able to show an element if there are no elements left by the filter.
>>
>> Basically my idea would be something like this, where I assign a class 
>> based on the count of the displayed elements
>>
>> <input ng-model="query" name="query">
>>
>> <ul>
>>   <li ng-repeat="todo in todos | filter:query">{{todo}}</li>
>> </ul>
>>
>> <p class="display-{{something like todos.length}}">There are no todos for 
>> given query</p>
>>
>> The problem is, that *.length* doesn't get updated with the filter, and 
>> something like *todos.count()* doesn't work.
>>
>> What is the proper way of doing this?
>>
>

-- 
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.

Reply via email to