Angular UI Components Documentation
The Angular Rating allows you to choose a rating. This guide adds the Angular Rating (jqxRating) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxrating 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxRatingModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxRatingModule } from 'jqwidgets-ng/jqxrating';
@Component({
selector: 'app-root',
imports: [jqxRatingModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana;">
<jqxRating #jqxRating
(onChange)="change($event)"
[width]="350"
[height]="35"></jqxRating>
<div style='margin-top: 10px;'>
<div style='float: left;'>Rating: </div><div style='float: left;' #rate></div>
</div>
</div>
import { Component, ElementRef, viewChild } from '@angular/core';
import { jqxRatingComponent } from 'jqwidgets-ng/jqxrating';
import { CommonModule } from '@angular/common';
import { jqxRatingModule } from 'jqwidgets-ng/jqxrating';
@Component({
imports: [CommonModule, jqxRatingModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
readonly rate = viewChild.required<ElementRef>('rate');
change(event: any): void {
let rate = this.rate().nativeElement;
rate.innerHTML = '<span> ' + event.value + '</span>';
}
}
Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, change: The change event is triggered when the rating is changed.
<jqxRating (onChange)="onChange($event)"></jqxRating>
onChange(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, val: Sets or gets the value.
<jqxRating #myRating></jqxRating>
import { Component, viewChild } from '@angular/core';
import { jqxRatingModule, jqxRatingComponent } from 'jqwidgets-ng/jqxrating';
@Component({
selector: 'app-root',
imports: [jqxRatingModule],
templateUrl: './app.html'
})
export class App {
readonly myRating = viewChild.required<jqxRatingComponent>('myRating');
run(): void {
const value = this.myRating().val();
console.log(value);
}
}