Improve this Doc View Source limitTo
- filter in module ng
Overview
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. Other array-like objects are also supported (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input, it is converted to a string.
Usage
In HTML Template Binding
{{ limitTo_expression | limitTo : limit : begin}} In JavaScript
$filter('limitTo')(input, limit, begin) Arguments
| Param | Type | Details |
|---|---|---|
| input | ArrayArrayLikestringnumber | Array/array-like, string or number to be limited. |
| limit | stringnumber | The length of the returned array or string. If the |
| begin (optional) | stringnumber | Index at which to begin limitation. As a negative index, |
Returns
Arraystring
|
A new sub-array or substring of length |
Example
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.
https://code.angularjs.org/1.8.2/docs/api/ng/filter/limitTo