August 7, 2022

A Highly Customizable and Responsive Star Rating Library With Angular

ng-star-rating is a simple, customizable, and highly responsive star rating library built with Angular.

star rating angular material, star rating in angular 8, star rating angular stackblitz, angular star rating example, ngx star rating, 5 star rating in angular

Features:

  • Simple and customizable
  • Lightweight. Built using CSS only
  • Responsive
  • Total number of parameterized stars

How to make use of it:

Installation

npm install ng-starrating

Usage

//app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RatingModule } from 'ng-starrating';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [ AppComponent ],
  imports: [ BrowserModule, RatingModule ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
<div style="text-align:center">
  <h1>
    ng-starrating demo
  </h1>
  <star-rating value="5" totalstars="5" checkedcolor="red" uncheckedcolor="black" size="24px" readonly="false" (rate)="onRate($event)"></star-rating>
</div>
//app.components.ts
import { Component } from '@angular/core';
import { StarRatingComponent } from 'ng-starrating';

@Component({ 
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  constructor() { }

  ngOnInit() { }

  onRate($event:{oldValue:number, newValue:number, starRating:StarRatingComponent}) {
    alert(`Old Value:${$event.oldValue}, 
      New Value: ${$event.newValue}, 
      Checked Color: ${$event.starRating.checkedcolor}, 
      Unchecked Color: ${$event.starRating.uncheckedcolor}`);
  }
}

Responsive Star Rating Library, ng-starrating Plugin/Github


See Demo And Download

Official Website(riteshgandhi): Click Here

This superior jQuery/javascript plugin is developed by riteshgandhi. For extra Advanced Usages, please go to the official website.

Share

You may also like...

Leave a Reply

Your email address will not be published.