File

packages/ui/src/lib/form/max-items.pipe.ts

Description

This pipe slices an array after the nth item

Metadata

Name maxItems

Methods

transform
transform(array: Array, maxItems: number, start: number)
Parameters :
Name Type Optional Default value
array Array<any> No []
maxItems number No
start number No 0
Returns : any
import { Pipe, PipeTransform } from '@angular/core';
/** This pipe slices an array after the nth item */
@Pipe({
  name: 'maxItems',
})
export class MaxItemsPipe implements PipeTransform {
  transform(array: Array<any> = [], maxItems: number, start: number = 0): any {
    return array.slice(start, maxItems);
  }
}

result-matching ""

    No results matching ""