I need to create UI as shown below. I need to order the name alphabetically and need to group like A,B and so on.
I have done the first part (i.e. order the name alphabetically using lodash) as shown below.
contacts.html
<ion-list>
<ion-item *ngFor="let c of contacts | async">
<name-and-rating item-start [data]="c"></name-and-rating>
<ion-input type="text" text-right disabled="true" [value]="c.company">
</ion-input>
</ion-item>
</ion-list>
name-and-rating.html (component)
<div>
<div>
{{data.name}}
</div>
<div>
<rating [ngModel]="data?.rating" (ngModelChange)="data.rating=$event" readOnly="true" max="5" emptyStarIconName="star-outline"
halfStarIconName="star-half" starIconName="star" nullable="false" name="rating" item-end>
</rating>
</div>
</div>
add-contact.ts
addContact() {
this.storage.get('contacts').then((val: Contact[]) => {
this.contacts = val;
if (this.contacts == null) this.contacts = [];
this.contacts.push(this.data);
const sortedContacts = orderBy(this.contacts, [c => c.name.toLowerCase()], ['asc']);
this.storage.set('contacts', sortedContacts).then((val: Contact[]) => {
this.close();
});
});
}
contact.ts
export class Contact {
id: string;
name: string;
company: string;
phone1: number;
phone2: number;
email: string;
rating: number;
comments: string;
}
Can you tell me how to design or implement alphabetically grouping like on the first image?

