I have the following ngFor statement and I want to sort by price. https://plnkr.co/edit/DC8I8DRB5UKhvWf6Sppl?p=preview
<div *ngFor="let coin of keys(); let i = index;">{{feeds[coin].price}}</div>
export class PricingTableComponent{
public feeds: FeedItemDictionary = {};
constructor(service: PricingApiService,private route:ActivatedRoute) {
this.feeds["btc"] = {price : 1,coin : "BitCoin"} ;
this.feeds["eth"] = {price : 2,coin : "Etherium"} ;
//... 1300 like this...
});
}
keys() {
return Object.keys(this.feeds);
}
}
interface FeedItemDictionary {
[ index: string ]: FeedItem // price and coin memebers
}
the problem is that this is a dictionary (I must use a dictionary or map).
Is it possible to sort by value member?
Can you please fix my example in plnkr?
Thanks