Skip to content

Instantly share code, notes, and snippets.

@mangar
Created October 5, 2016 18:22
Show Gist options
  • Save mangar/1e17710ccd90ece89406598c390389b2 to your computer and use it in GitHub Desktop.
Save mangar/1e17710ccd90ece89406598c390389b2 to your computer and use it in GitHub Desktop.
ToArray Pipe for Angular2
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'toArray'})
export class ToArray implements PipeTransform {
transform(value: number, exponent: string[]): number {
let res = [];
for (let i = 1; i <= value; i++) {
res.push(i);
}
return res;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment