diff --git a/src/app/star/star.component.ts b/src/app/star/star.component.ts index 6c9e940..ac62cf6 100644 --- a/src/app/star/star.component.ts +++ b/src/app/star/star.component.ts @@ -6,13 +6,11 @@ import {Component, Input} from '@angular/core'; imports: [], template: ` @for (_ of getList(); track null) { - test - + } @if (rating % 1 >= 0.5) { - + } - `, }) export class StarComponent { @@ -20,8 +18,11 @@ export class StarComponent { public rating: number = 0; public getList(): null[] { - console.log(this.rating) - console.log(Array(this.rating).fill(null)) - return Array(this.rating).fill(null); + let rating = this.rating; + if (rating % 1 !== 0) { + rating = this.rating - 0.5; + } + + return Array(rating).fill(null); } }