Skip to content

Instantly share code, notes, and snippets.

@aman-gautam
Last active August 20, 2020 05:20
Show Gist options
  • Save aman-gautam/8a25e2906003e7caaa3e261c69c3810d to your computer and use it in GitHub Desktop.
Save aman-gautam/8a25e2906003e7caaa3e261c69c3810d to your computer and use it in GitHub Desktop.
Ionic stars implementation. For some reason, many developers prefer the more complex packages, for simple use cases this is enough.
<!-- For a rating of 1 to 5 stars -->
<!-- Editable -->
<ion-item>
<ion-icon
*ngFor="let i of [1,2,3,4,5]"
(click)="value = i"
[color]="value < i? '': 'primary'"
[name]="value < i? 'star-outline': 'star'">
</ion-icon>
</ion-item>
<!-- Read Only -->
<ion-item>
<ion-icon
*ngFor="let i of [1,2,3,4,5]"
[color]="value < i? '': 'primary'"
[name]="value < i? 'star-outline': 'star'">
</ion-icon>
</ion-item>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment