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 = 2;
isReadOnly:boolean = false;
onClick(){
this.isReadOnly = !this.isReadOnly;
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - Editable And Readonly Rating
</h4>
<div>Current Rate: <b>{{currentRate}}</b></div>
<br/>
<h5>
Rating is now {{isReadOnly? 'read only' : 'editable'}}
</h5>
<br/>
<ngb-rating
[(rate)]="currentRate"
[readonly]="isReadOnly">
</ngb-rating>
<br/><br/>
<button (click)="onClick()" >Toggle Editable</button>
- angular bootstrap - How to use Collapse
- angular bootstrap - How to use Rating
- angular bootstrap - Rating hover event
- 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 - Popover manual triggers
- angular bootstrap - Popover custom CSS class
- angular bootstrap - Popover shown & hidden event
- angular bootstrap - Datepicker navigate to current month
- angular bootstrap - Datepicker navigate to specific year month
- angular bootstrap - Datepicker navigate select specific date
- angular bootstrap - Datepicker default visible year month
- angular bootstrap - How to show Datepicker in a popup