I am sorting array with function
sortArray(x){
if(x == ‘Hour’){
this.temp_bitcoin = this.bitcoinData.sort((a: any, b: any) => {
return b[‘percent_change_1h’] - a[‘percent_change_1h’];
});
this.showSomeData(this.temp_bitcoin);
}else if(x == 'Day'){
this.temp_bitcoin= this.bitcoinData.sort((a: any, b: any) => {
return b['percent_change_24h'] - a['percent_change_24h'];
});
this.showSomeData(this.temp_bitcoin)
}else if(x == 'Week'){
this.temp_bitcoin = this.bitcoinData.sort((a: any, b: any) => {
return b['percent_change_7d'] - a['percent_change_7d'];
});
this.showSomeData(this.temp_bitcoin)
}
return this.temp_bitcoin;
}
now i want to show only 50 items in the array. But hte view is not updating the array as sorted . Like initially the array will be sorted hourly but after its week the array title will not change only its value updates