How to invalidate the filter cache from the controller?
Em quinta-feira, 6 de março de 2014 16h31min32s UTC-3, Alexandre Verri
escreveu:
>
> Hi Sander,
>
> I've noticed that the performance is much better in the last pages. It's
> due to the filter 'startFrom', which slices the data from a start index up
> to the final.
>
> // The oldert filter, with poor performance in the initial pages.
> app.filter('startFrom', function () {
> return function (input, start) {
> return input.slice(start);
> };
> });
>
>
> // The new filter, with good performance regardless the page number.
> app.filter('pageFilter', function () {
> return function (input, currentPage, pageSize) {
> var start = currentPage*pageSize;
> var end = start + pageSize;
> return input.slice(start, end);
> };
> });
>
> I've changed our fiddle to fix the problem:
>
> http://jsfiddle.net/averri/pva4z/4/
>
>
>
>
>
> Em quinta-feira, 6 de março de 2014 15h01min16s UTC-3, Alexandre Verri
> escreveu:
>>
>> Sander,
>>
>> your implementation is better. I'll use it and include your name as the
>> author.
>>
>> I'll do a little change in order to invalidate the cache in case of
>> $scope.data changes.
>>
>> Thank you very much.
>>
>> Regards,
>> Alexandre
>>
>> Em quinta-feira, 6 de março de 2014 14h49min25s UTC-3, Sander Elias
>> escreveu:
>>>
>>> Alexander,
>>>
>>> Mine does basically the same as yours, only without external
>>> dependencies.
>>> And it's using less function calls. Not a big issue, but 1.000.000 x
>>> something tiny starts to count.
>>>
>>> Regards,
>>> Sander
>>>
>>
--
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/groups/opt_out.