Created
March 5, 2019 14:57
-
-
Save arekko/f7e352624e1b9ceec4379730c7d84207 to your computer and use it in GitHub Desktop.
Angular array reverse pipe
This file contains hidden or 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> | |
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