Search code examples
javascriptangularjsperformanceangularjs-limitto

Does the limitTo filter in angular prevent loading other items in ng-repeat?


If I implement a 'load more' button that increases the limitTo filter in Angular.js, does the filter prevent loading the whole ng-repeat array?

What if I for example have 100 images in my ng-repeat. And i implement a limitTo filter with '9' on this. Is the user downloading the 100 images on page load or just the 9 images?


Solution

  • Yes.It limits to 9 images.

    Here it is from the Angular Doc:

    limitTo

    Creates a new array or string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string.