1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. All Rights Reserved.
|
4
|
*
|
5
|
* Use of this source code is governed by an MIT-style license that can be
|
6
|
* found in the LICENSE file at https://angular.io/license
|
7
|
*/
|
8
|
import { PipeTransform } from '@angular/core';
|
9
|
/**
|
10
|
* @ngModule CommonModule
|
11
|
* @whatItDoes Creates a new List or String containing a subset (slice) of the elements.
|
12
|
* @howToUse `array_or_string_expression | slice:start[:end]`
|
13
|
* @description
|
14
|
*
|
15
|
* Where the input expression is a `List` or `String`, and:
|
16
|
* - `start`: The starting index of the subset to return.
|
17
|
* - **a positive integer**: return the item at `start` index and all items after
|
18
|
* in the list or string expression.
|
19
|
* - **a negative integer**: return the item at `start` index from the end and all items after
|
20
|
* in the list or string expression.
|
21
|
* - **if positive and greater than the size of the expression**: return an empty list or string.
|
22
|
* - **if negative and greater than the size of the expression**: return entire list or string.
|
23
|
* - `end`: The ending index of the subset to return.
|
24
|
* - **omitted**: return all items until the end.
|
25
|
* - **if positive**: return all items before `end` index of the list or string.
|
26
|
* - **if negative**: return all items before `end` index from the end of the list or string.
|
27
|
*
|
28
|
* All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
|
29
|
* and `String.prototype.slice()`.
|
30
|
*
|
31
|
* When operating on a [List], the returned list is always a copy even when all
|
32
|
* the elements are being returned.
|
33
|
*
|
34
|
* When operating on a blank value, the pipe returns the blank value.
|
35
|
*
|
36
|
* ## List Example
|
37
|
*
|
38
|
* This `ngFor` example:
|
39
|
*
|
40
|
* {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
|
41
|
*
|
42
|
* produces the following:
|
43
|
*
|
44
|
* <li>b</li>
|
45
|
* <li>c</li>
|
46
|
*
|
47
|
* ## String Examples
|
48
|
*
|
49
|
* {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
|
50
|
*
|
51
|
* @stable
|
52
|
*/
|
53
|
export declare class SlicePipe implements PipeTransform {
|
54
|
transform(value: any, start: number, end?: number): any;
|
55
|
private supports(obj);
|
56
|
}
|