Skip to content

Instantly share code, notes, and snippets.

@umutyerebakmaz
Created February 10, 2020 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umutyerebakmaz/ce8edaff264610798206ea81750b2083 to your computer and use it in GitHub Desktop.
Save umutyerebakmaz/ce8edaff264610798206ea81750b2083 to your computer and use it in GitHub Desktop.
Get the array element by index
toolTips = ['Kötü', 'Orta', 'İyi', 'Çok İyi', 'Mükemmel'];
getTooltip(index: number): string {
return this.toolTips[index];
}
<button mat-icon-button
*ngFor="let ratingId of ratingArr; index as i" [id]="'star_'+i"
(click)="onClick(i+1)"
[matTooltip]="getTooltip(ratingId)"
matTooltipPosition="above">
<mat-icon class="material-icons">{{showIcon(i)}}</mat-icon>
</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment