diff --git a/src/app/vote-choice/vote-choice.component.ts b/src/app/vote-choice/vote-choice.component.ts index 95097f32..ab31a590 100644 --- a/src/app/vote-choice/vote-choice.component.ts +++ b/src/app/vote-choice/vote-choice.component.ts @@ -1,5 +1,4 @@ import {Component, Input} from '@angular/core'; -import {environment} from "../../environments/environment"; interface VoteChoice { votesCount: { @@ -8,8 +7,8 @@ interface VoteChoice { maybe: number notAnswered: number }; - text: string; - date: Date; + text?: string; + date?: Date; answer: 'yes' | 'no' | 'maybe' | null; simpleAnswer: boolean; // enable if we display only a togglable "yes" } @@ -25,17 +24,21 @@ interface VoteChoice { }) export class VoteChoiceComponent { - @Input() choice: VoteChoice; + @Input() choice: VoteChoice = { + date: new Date(), + text: 'description ', + votesCount: { + yes: 0, + no: 0, + maybe: 0, + notAnswered: 0 + }, + simpleAnswer: false, + answer: null + }; constructor() { - if (!environment.production) { - // demo content for dev env - this.choice = { - date: new Date(), - text: 'description ', - simpleAnswer: false - } - } + } setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {