I made the following structure in my json file with Firebase Real Time Database to work on Composer and his Compositions:
I have the following service that give me the data of one composer with his composition
getComposerWithKey(key: string): Observable<Composer> {
const memberPath = `composer/${key}`;
this.composer = this.db.object(memberPath)
.snapshotChanges().map(action => {
const $key = action.payload.key;
const arrcompositions = action.payload.val().compositions?Object.entries(action.payload.val().compositions):null;
const data = {
$key,
arrcompositions,
...action.payload.val() };
return data;
});
return this.composer
}
Now I can get the composer info with a list of his compositions with the ngFor directive :
<mat-list-item *ngFor="let composition of composer.arrcompositions">
{{ composition[1] }}
</mat-list-item>
My problem is that I can't order the compositions in alphabetic order. I tried to use the ngx-order-pipe but I don't know how to precise the value used to order
<mat-list-item *ngFor="let composition of composer.arrcompositions | orderBy: 'composition[1]'">
{{ composition[1] }}
This obviously doesn't work...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With