2018-11-19 16:57:35 +02:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'ngx-interactive-progress-bar',
|
|
|
|
|
templateUrl: 'interactive-progress-bar.component.html',
|
|
|
|
|
styleUrls: ['interactive-progress-bar.component.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class InteractiveProgressBarComponent {
|
|
|
|
|
|
|
|
|
|
value = 25;
|
|
|
|
|
|
|
|
|
|
setValue(newValue) {
|
|
|
|
|
this.value = Math.min(Math.max(newValue, 0), 100);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-26 15:17:57 +03:00
|
|
|
get status() {
|
2018-11-19 16:57:35 +02:00
|
|
|
if (this.value <= 25) {
|
|
|
|
|
return 'danger';
|
|
|
|
|
} else if (this.value <= 50) {
|
|
|
|
|
return 'warning';
|
|
|
|
|
} else if (this.value <= 75) {
|
|
|
|
|
return 'info';
|
|
|
|
|
} else {
|
|
|
|
|
return 'success';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|