In my current project using Ionic, I am developing a personal application where I aim to implement an alphabetical header/divider for a list of games. The idea is to check the first letter of each game, and whenever it differs from the last game's initial letter (assuming they are sorted), a header should be generated.
Let me share my `firstLetter()` function with you:
public firstLetter(name: any) {
return name.charAt(0);
}
Furthermore, here is the snippet from my HTML/ng file:
<ion-item-group *ngFor="let game of games; let i = index;">
<ion-item-divider color="light" *ngIf="firstLetter(game.name) != firstLetter(game[i-1].name)">{{firstLetter(game.name)}}</ion-item-divider>
<ion-item (click)="openGameSummary(game)">
<h2>{{game.name}}</h2>
</ion-item>
</ion-item-group>
I am encountering an
error stating that the property 'name' cannot be found,
likely due to incorrect syntax usage on my end.
Can someone guide me on how to resolve this issue effectively?