Created
July 3, 2017 14:50
-
-
Save codediodeio/5b0cb8943ed450ae168ddb576e8aab72 to your computer and use it in GitHub Desktop.
Reverse a FirebaseListObservable in Angular 4
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
<div *ngFor="let item of listObservable | async | reverse"> | |
{{item?.whatever}} | |
</div> |
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: 'reverse' | |
}) | |
export class ReversePipe implements PipeTransform { | |
transform(value) { | |
if (!value) return; | |
return value.reverse(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment