0.0.4 • Published 4 years ago

ng-custom-rating v0.0.4

Weekly downloads
19
License
-
Repository
github
Last release
4 years ago

ng-custom-rating

star rating library built for angular

Features

  • You can use your own icons for rating selection

  • User can select half rating (eg 1.5,2.5,3.5 .....)

How to use

  • Download star icons from this link(or you can use your own icons)

  • npm i ng-custom-rating

using package

.....
...
import { NgCustomRatingModule } from 'ng-custom-rating';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
 ..... ,
    NgCustomRatingModule
  ]

Example

app.componenet.html

<custom-ratings 
[UncheckedIcon] ='"assets/images/emptyStar.svg"'
[CheckedIcon] ='"assets/images/fullstar.svg"'
[HalfCheckedIcon] ='"assets/halfstar.svg"'
[Iconwidth] = "'25'"
[RatingCount] = 5
[DisableHalfRating] = false
[DefaultRating] = 2
[disableSelect] = false
(selectedRating)='getRating($event)'
></custom-ratings >

app.componenet.ts

  getRating(data){
  console.log(data)
}

Input Parameters

Namevalue / typeDescription
UncheckedIconStringFile path of icon used to show unchecked icon
CheckedIconStringFile path of icon used to show checked icon
HalfCheckedIconStringFile path of icon used to show halfchecked icon
IconwidthstringWidth of the rating icons
RatingCount(optional)NumberTotal number of icons used for rating selection( if not given , default value will be 5)
DisableHalfRating(optional)booleandisables the user from selecting half stars
DefaultRatingNumberpre populate the rating ui with selected icons
disableSelectbooleanused to diable the rating selection
selectedRatingEventemitterused to get the selected rating count