Installation
npm install ngx-rating-stars@latest
Copy the 3 stars images files in /node_modules/ngx-rating-stars into /assets/images
##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 size has informations for styles
##Demo
https://stackblitz.com/github/AndreaDiCioccio/ngx-rating-stars-demo