Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-stars-rating

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-stars-rating

## Overview Ngx Stars Rating is a straightforward Angular module designed for Angular 14 and above. It offers customizable star icons using Material Icons, Antd Icons, and other options.

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
83
increased by33.87%
Maintainers
1
Weekly downloads
 
Created
Source

Ngx Stars Rating Module

Overview

Ngx Stars Rating is a straightforward Angular module designed for Angular 14 and above. It offers customizable star icons using Material Icons, Antd Icons, and other options.

Ngx Stars Rating

Demo

Explore the live demo here.

Installation

Ensure you have Angular 13 or a later version installed.

To install the ngx-stars-rating module via npm, navigate to your project directory and run:

cd project_folder
npm install --save ngx-stars-rating

Usage

  1. Import the NgxStarsRatingModule into your Angular module:
import { NgxStarsRatingModule } from 'ngx-stars-rating';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, NgxStarsRatingModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
  1. Add the <ngx-stars-rating> component to your HTML file:
<!-- app.component.html -->
<ngx-stars-rating></ngx-stars-rating>
  1. Optionally, configure the rating by providing input properties such as rate, options, and handling events such as (onRate):
<ngx-stars-rating
  [rate]="rateNumber"
  [options]="ratingOptions"
  (onRate)="onClickRate($event)"
  [starTemplate]="starCustomTemplate"
></ngx-stars-rating>
import { IRatingOptions } from 'ngx-stars-rating';

export class AppComponent {
    public rateNumber: number = 4.7;
    public ratingOptions: IRatingOptions = {
        starsCount: 5,
        hoverable: true,
        clickable: true
    };

    public onClickRate(rate: number): void {
        console.log(rate, 'rate'); // Logs the clicked star number
    }
}
  1. Customize stars using templates:
<ng-template #starCustomTemplate>
  <span class="material-symbols-outlined" style="font-size: 55px">star</span>
</ng-template>

Future Updates

In future versions, support for Forms and ReactiveForms (ngModel and formControl/formControlName) directives will be added.

Keywords

FAQs

Package last updated on 29 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc