Sort() doesn't work correct for Alphabetical List any help


#1

I’m using sort() method for making Alphabetical List but it seems not working correctly

// sorting data
      this.Clinics = Data.sort(function(a, b){
        return a.name.localeCompare(b.name);
      })


#2

i tried to add toLowerCase() after name but didn’t solve it


#3

This is not an Ionic issue. I would suggest turning to StackOverflow to understand how to sort your array, or what you might need to do to create a custom sort filter.