diff --git a/src/app/filters/avis-bar/avis-bar.component.ts b/src/app/filters/avis-bar/avis-bar.component.ts index e176344..e4757b7 100644 --- a/src/app/filters/avis-bar/avis-bar.component.ts +++ b/src/app/filters/avis-bar/avis-bar.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; @Component({ selector: 'app-avis-bar', @@ -8,6 +8,8 @@ import { Component, OnInit } from '@angular/core'; export class AvisBarComponent implements OnInit { starStates: {stateSelectedUser : boolean, stateHoverUser : boolean}[]; + @Output() stateNumber = new EventEmitter(); + starStateNumber: number = 0; constructor() { @@ -29,7 +31,6 @@ export class AvisBarComponent implements OnInit { } onMouseOver(index: number) { - console.log("star over", index); for (let i = 0; i < this.starStates.length ; i++) { if(i <= index) { this.starStates[i].stateHoverUser = true; @@ -53,13 +54,17 @@ export class AvisBarComponent implements OnInit { } onClickStar(starIndex: number) { + this.starStateNumber = 0; for (let i = 0; i < this.starStates.length ; i++) { if(i <= starIndex) { this.starStates[i].stateSelectedUser = true; + this.starStateNumber++; } else { this.starStates[i].stateSelectedUser = false; } } + //console.log(`Rating : ${this.starStateNumber}`); + this.stateNumber.emit(this.starStateNumber); } } diff --git a/src/app/pages/filters-page/filters-page.component.html b/src/app/pages/filters-page/filters-page.component.html index bfd1eda..66ef2e9 100644 --- a/src/app/pages/filters-page/filters-page.component.html +++ b/src/app/pages/filters-page/filters-page.component.html @@ -17,7 +17,7 @@