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

jbs-star-rating

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jbs-star-rating

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.0.

  • 0.0.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

JbsStarRating

This library was generated with Angular CLI version 18.2.0.

Code scaffolding

Run ng generate component component-name --project jbs-star-rating to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project jbs-star-rating.

Note: Don't forget to add --project jbs-star-rating or else it will be added to the default project in your angular.json file.

Build

Run ng build jbs-star-rating to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build jbs-star-rating, go to the dist folder cd dist/jbs-star-rating and run npm publish.

Running unit tests

Run ng test jbs-star-rating to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

Installation

To use the Star Rating Component in your Angular project, follow the steps below: Install the component via npm (assuming you've published it as a library on npm): npm install jbs-star-rating@0.0.5

Once installed, import the component into your Angular application.

Import and Configure the Component

In an Angular Standalone Component: In your standalone component, you can directly import the Star Rating Component. import { JbsStarRatingComponent } from 'jbs-star-rating'; @Component({ selector: 'app-product-detail', templateUrl: './product-detail.component.html', standalone: true, imports: [JbsStarRatingComponent] }) export class ProductDetailComponent { // Your logic here }

Usage

You can use the Star Rating Component by adding it to your template with customizable inputs for rating, number of stars, star size, color, and spacing. Example Template:

<lib-jbs-star-rating [rating]="4" [starCount]="5" [color]="'#f39c12'" [starSize]="40" [starSpacing]="10" [allowHalfStars]="true" (ratingUpdated)="onRatingUpdated($event)">

Example Usage in a Parent Component

In your parent component, you can manage the rating logic and handle the output event. Parent Component TypeScript (product-detail.component.ts):

export class ProductDetailComponent { currentRating = 4.5; // Default rating

// Handles when a user clicks on a star to update the rating onRatingUpdated(newRating: number) { this.currentRating = newRating; console.log('Updated Rating:', newRating); } }

Parent Component HTML (product-detail.component.html):

<lib-jbs-star-rating [rating]="currentRating" [starCount]="5" [color]="'#ffcc00'" [starSize]="40" [starSpacing]="8" [allowHalfStars]="true" (ratingUpdated)="onRatingUpdated($event)">

FAQs

Package last updated on 23 Sep 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