• Overview
@angular/common

SlicePipe

pipe

Creates a new Array or String containing a subset (slice) of the elements.

  
    class SlicePipe implements PipeTransform {
}

transform

5 overloads
@paramvaluereadonly T[]

a list or a string to be sliced.

@paramstartnumber

the starting index of the subset to return:

  • 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.
  • if positive and greater than the size of the expression: return an empty list or string.
  • if negative and greater than the size of the expression: return entire list or string.
@paramendnumber | undefined

the ending index of the subset to return:

  • omitted: return all items until the end.
  • if positive: return all items before end index of the list or string.
  • if negative: return all items before end index from the end of the list or string.
@returnsT[]
@paramvaluenull | undefined
@paramstartnumber
@paramendnumber | undefined
@returnsnull
@paramvaluereadonly T[] | null | undefined
@paramstartnumber
@paramendnumber | undefined
@returnsT[] | null
@paramvaluestring
@paramstartnumber
@paramendnumber | undefined
@returnsstring
@paramvaluestring | null | undefined
@paramstartnumber
@paramendnumber | undefined
@returnsstring | null
Jump to details