Menu

AngularJS | LimitTo Filter

The limitTo filter in AngularJS is used to returns an array or a string which contains a specified number of elements. This filter can be used with arrays, strings, and numbers. The basic principle, however, remains the same in all the three cases.

 
  • For arrays, it returns an array containing only the specified number of items.
  • When used for strings, it returns another string containing the specified number of characters.
  • In the case of numbers, it returns a string containing only the specified number of digits.
  • Negative numbers are used to return elements starting from the end of the element, instead of the beginning.

Syntax:

{{ object | limitTo : limit : begin }}

Parameters:

  • limit: Number of returned elements.
  • begin: Begin point of limitation. default is 0.
833
Search

Ads