Created
October 5, 2016 18:22
-
-
Save mangar/1e17710ccd90ece89406598c390389b2 to your computer and use it in GitHub Desktop.
ToArray Pipe for Angular2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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