Sorting Array Issue

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

Why is this in the ionic-native category?

@rapropos :cry:
If you could help then please do it. Its ionic in anyways

Please provide a Sample Array which you are working with, then it will be easier for us to debug.

Also, indent/format your code properly for better readability.

@saidatta123

the array is actually the response of https://api.coinmarketcap.com/v1/ticker/ the link

@saidatta123

the array is actually the response of https://api.coinmarketcap.com/v1/ticker/ the link
[/quote]

i am trying to use infinite scroll with 50 data each. But array was not refreshing on sorting