ngx-rating-stars
https://ibb.co/K9y7725
Installation
npm install ngx-rating-stars@latest
Usage
ngModule
import { NgxRatingStarsModule } from 'ngx-rating-stars'
@NgModule({
...
imports: [
...
NgxRatingStarsModule
]
})
angular.json
"build": {
...
"assets": [
{
"glob": "**/*",
"input": "./node_modules/ngx-rating-stars/images",
"output": "./assets/images"
}
]
}
template
<ngx-rating-stars
[rating]="rating"
[style]="ratingStyle"
[showRatingInNumericFormat]="true">
</ngx-rating-stars>
component
rating = {
value:3.6,
count:12
}
ratingStyle = {
starsStyle: {'height' : '22px', 'width' : '22px'},
ratingStyle: {'font-size' : '18px'},
countStyle: {'font-size' : '14px'}
}
The object rating has the value of rating and the count of all ratings (12 votes) proprieties.
The object ratingStyle has informations for styles.
Demo
https://stackblitz.com/github/AndreaDiCioccio/ngx-rating-stars-demo