Created
June 8, 2016 17:48
-
-
Save StephenFluin/5bea382b314979942c1748555c500271 to your computer and use it in GitHub Desktop.
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: 'reFirebase'}) | |
export class ValuesPipe implements PipeTransform { | |
transform(value: any, args?: any[]): any[] { | |
let keys = Object.keys(value), | |
output = []; | |
keys.forEach(key => { | |
let arrayItem = value[key]; | |
if(key != "$key") { | |
arrayItem.$key = key; | |
output.push(arrayItem); | |
} | |
}); | |
return output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage: