import { Component , Input , OnChanges } from '@angular/core' ; @ Component ( { selector : 'mh-star' , templateUrl : './star.component.html' , styleUrls : [ './star.component.css' ] } ) export class StarComponent implements OnChanges { @ Input ( ) rating : number ; starWidth = 0 ; ngOnChanges ( ) { this . starWidth = this . rating * 75 / 5 ; } }