export class SlicePipe
export class SlicePipe
exported from angular2/common defined in angular2/src/common/pipes/slice_pipe.ts (line 5)
Creates a new List or String containing only a subset (slice) of the elements.
The starting index of the subset to return is specified by the start
parameter.
The ending index of the subset to return is specified by the optional end
parameter.
Usage
expression | slice:start[:end]
All behavior is based on the expected behavior of the JavaScript API Array.prototype.slice() and String.prototype.slice()
Where the input expression is a [List] or [String], and start
is:
- a positive integer: return the item at start index and all items after in the list or string expression.
- a negative integer: return the item at start index from the end and all items after in the list or string expression.
|start|
greater than the size of the expression: return an empty list or string.|start|
negative greater than the size of the expression: return entire list or string expression.
and where end
is:
- omitted: return all items until the end of the input
- a positive integer: return all items before end index of the list or string expression.
- a negative integer: return all items before end index from the end of the list or string expression.
When operating on a [List], the returned list is always a copy even when all the elements are being returned.
List Example
This ngFor
example:
produces the following:
<li>b</li>
<li>c</li>
String Examples
Annotations
@Pipe({name: 'slice', pure: false})
@Pipe({name: 'slice', pure: false})
@Injectable()
@Injectable()
Members
transform(value: any, args?: any[]) : any
transform(value: any, args?: any[]) : any
Not Yet Documented
supports(obj: any) : boolean
supports(obj: any) : boolean
Not Yet Documented