Angular Rating component is a star based selection input.
Setup
Refer to PrimeNG setup documentation for download and installation steps for your environment.
Import
import {RatingModule} from 'primeng/rating';
Getting Started
Two-way value binding is defined using ngModel.
<p-rating [(ngModel)]="val"></p-rating>
export class ModelComponent {
val: number;
}
Defining a default value would be enough to display the initial number of selected stars.
export class ModelComponent {
val: number = 3;
}
Model Driven Forms
Rating can be used in a model driven form as well.
<p-rating formControlName="score"></p-rating>
Theming
Rating supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.
Resources
Visit the PrimeNG Rating showcase for demos and documentation.