import { Component, Input, OnInit } from '@angular/core'; @Component({ selector: 'onguard-mos-score', templateUrl: './mos-score.component.html', styleUrls: ['./mos-score.component.scss'] }) export class MosScoreComponent implements OnInit { @Input() score: number; public grade: 'bad' | 'poor' | 'fair' | 'good' | 'excellent'; constructor() { } ngOnInit(): void { } ngOnChanges(): void { if (this.score < 1) { this.grade = 'bad'; } else if (this.score < 2) { this.grade = 'poor'; } else if (this.score < 3) { this.grade = 'fair'; } else if (this.score < 4) { this.grade = 'good'; } else { this.grade = 'excellent'; } } }