app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
currentRate:number = 4;
hovered:number = 0;
textColor = "black";
onHover(value:number){
this.hovered = value;
this.textColor = "blue";
}
onLeave(){
this.hovered = 0;
this.textColor = "gray";
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - Rating hover event
</h4>
<div>Current Rate: <b>{{currentRate}}</b></div>
<br/>
<div [style.color]="textColor">
Hovered : {{hovered}}
</div>
<br/>
<ngb-rating
[(rate)]="currentRate"
(hover)="onHover($event)"
(leave)="onLeave()">
</ngb-rating>
- angular bootstrap - How to use Collapse
- angular bootstrap - How to use Rating
- angular bootstrap - Readonly & editable Rating
- angular bootstrap - How to show Toast message
- angular bootstrap - Progressbar maximum value
- angular bootstrap - How to show striped Progressbar
- angular bootstrap - Light & dark Progressbar
- angular bootstrap - How to use Popover
- angular bootstrap - Open Popover on mouse hover
- angular bootstrap - Open close Popover on button click
- angular bootstrap - Popover manual triggers
- angular bootstrap - Popover custom CSS class
- angular bootstrap - Popover shown & hidden event
- angular bootstrap - Timepicker without spinner
- angular bootstrap - Timepicker custom steps