To preview demo of star rating project, click here
Download star-rating.component
to your angular material project and include required components from angular material.
<mat-star-rating [rating]="rating" [starCount]="starCount" [color]="starColor" (ratingUpdated)="onRatingChanged($event)"></mat-star-rating>
@Input('rating') rating: number;
@Input('starCount') starCount: number;
@Input('color') color: string;
Name | Description |
---|---|
rating | Actual rating |
starCount | Maximum number of stars for rating |
color | Color of star in rating. Chosen from theme. primary , accent or warn |
enum StarRatingColor {
primary = "primary",
accent = "accent",
warn = "warn"
}
onRatingChanged(rating){
console.log(rating);
this.rating = rating;
}