Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70749

Sort array by name

$
0
0

@champion007 wrote:

Hi Folks,

I am doing POC where i display contact details of the phone using ionic native contact plugin. Contact display is random there is no order.

How to sort them alphabetically, below is my code -

this.contacts.find(["displayName", "phoneNumbers"],
    {multiple: true, hasPhoneNumber: true }
    ).then((contacts) => {
      for (var i = 0; i < contacts.length; i++) {
        if (contacts[i].displayName !== null) {
          var contact = {};
          contact["name"] = contacts[i].displayName;
          this.contactList.push(contact);
        }
      }
      this.groupContacts(this.contactList);
    });

This code above gives me contact names randomly , is there any way i can sort them.

Appreciated.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70749

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>